Welcome to the fracta.net forum!

Share your coding ideas or ask questions.

Question Excel Macro to Automate Skill/Level changes for Avaya CMS

  • quende
  • Visitor
  • Visitor
10 years 7 months ago - 10 years 7 months ago #292 by quende

Also why not keep the Server connection open and re-use it each 5 seconds instead of killing it and re-creating it? Or even have the Avaya CMS application running and hook into it's server object.


Well, im glad to do like that, but can you give the cue? I want that, i want to keep connection and yeah.. i have the Avaya CMS application running during all this time.

I checked Task Manager, and there were only CMS's tasks in a single copy, but if i kill some of them like this (when it was "freezed"), i cant even login my CMS app after that. It was like this



and never changes
Attachments:
Last edit: 10 years 7 months ago by quende.

Please Log in or Create an account to join the conversation.

More
10 years 7 months ago #293 by roller
Hi, there are many ways you can keep the connection open. You can do all the work in one Sub or break it up into few Subs.

Have a look at this, it will re-run every minute. Sorry the code is not tested check it for spelling mistake and change to your settings:

Dim cvsApp As Object
Dim cvsConn As Object
Dim cvsSrv As Object
Dim Rep As Object
Dim Info As Object, Log As Object, b As Object


Sub Pull_Report()
OpenConn
Do While True
Application.Wait (Now() + TimeValue("00:01:00"))
CMSGetReport
Loop
closeConn
End Sub



Sub OpenConn()
Const Username As String = "xxxxxx"
Const Password As String = "xxxxxxxxx"
Set cvsApp = CreateObject("ACSUP.cvsApplication")
Set cvsConn = CreateObject("ACSCN.cvsConnection")

Set cvsSrv = CreateObject("ACSUPSRV.cvsServer")
'Set cvsSrv = cvsApp.servers(1)
Set Rep = CreateObject("ACSREP.cvsReport")
If cvsApp.CreateServer(Username, "", "", "1xx.xxx.xxx.xxx", False, "ENU", cvsSrv, cvsConn) Then
If cvsConn.Login(Username, Password, "1xx..xxx.xxx.xxx", "ENU") Then
End If
End If
'or Set cvsSrv = cvsApp.servers(1)
End Sub

Sub closeConn()
cvsConn.Logout
cvsConn.Disconnect
Set Log = Nothing
Set Rep = Nothing
Set cvsSrv = Nothing
Set cvsConn = Nothing
Set cvsApp = Nothing
End Sub

Public Sub CMSGetReport()
Dim sReportName As String
sReportName = "REPORTS PATH"


On Error Resume Next

cvsSrv.Reports.ACD = 1
Set Info = cvsSrv.Reports.Reports(sReportName)

If Info Is Nothing Then
If cvsSrv.Interactive Then
MsgBox "The Report " & sReportName & " was not found on ACD 1", vbCritical Or vbOKOnly, "CentreVu Supervisor"
Else
Set Log = CreateObject("ACSERR.cvslog")
Log.AutoLogWrite "The Report " & sReportName & " was not found on ACD 1"
Set Log = Nothing
End If


Else
b = cvsSrv.Reports.CreateReport(Info, Rep)
If b Then
cvsRepProp.SetProperty "Splits/Skills", "SOME SKILLS"
b = cvsRepProp.ExportData("", 9, 0, True, True, False)
Rep.Quit
If Not cvsSrv.Interactive Then cvsSrv.ActiveTasks.Remove Rep.TaskID
Set Rep = Nothing
End If
End If

Set Info = Nothing


End Sub

Please Log in or Create an account to join the conversation.

  • Tyger0951
  • Visitor
  • Visitor
9 years 8 months ago #404 by Tyger0951
So I used the code from above and got it mostly work.


I am able to get it to run if i type in the IDs manually but using the method of agents="2303;2402;" doesn't work for me.

If i run it with agents inputed I get Run Time error "9" subscript out of range.


Sub ChangeSkills()

Dim agents As String
Dim cvsApp As Object
Dim cvsConn As Object
Dim cvsSrv As Object
Dim SetArr() As Variant
Dim sWarn As String
Dim Skills() As Variant


ReDim SetArr(3, 4)
SetArr(1, 1) = 3
SetArr(1, 2) = 1
SetArr(1, 3) = 0
SetArr(1, 4) = 0
SetArr(2, 1) = 346
SetArr(2, 2) = 2
SetArr(2, 3) = 0
SetArr(2, 4) = 0
SetArr(3, 1) = 342
SetArr(3, 2) = 2
SetArr(3, 3) = 0
SetArr(3, 4) = 0

Set cvsApp = CreateObject("ACSUP.cvsApplication")
Set cvsConn = CreateObject("ACSCN.cvsConnection")
Set cvsSrv = CreateObject("ACSUPSRV.cvsServer")

Set cvsSrv = cvsApp.Servers(1)

sWarn = ""

agents = "2402"

Set AgMngObj = cvsSrv.AgentMgmt
AgMngObj.AcdStartUp -1, "", cvsSrv.ServerKey, -1
AgMngObj.OleAgentSetSkill_R16_1 2, "" & agents & "", 1, 0, 0, 0, 3, SetArr, "" ' This is were the error occrus

Set AgMngObj = Nothing

Set cvsApp = Nothing
Set cvsConn = Nothing
Set cvsSrv = Nothing



End Sub

Please Log in or Create an account to join the conversation.

  • Tyger0951
  • Visitor
  • Visitor
9 years 8 months ago #405 by Tyger0951
Able to get code to work if I type in the names manually but not working the Agents method. Any suggestions?
Code:
Sub ChangeSkills() Dim agents As String Dim cvsApp As Object Dim cvsConn As Object Dim cvsSrv As Object Dim SetArr() As Variant Dim sWarn As String Dim Skills() As Variant ReDim SetArr(3, 4) SetArr(1, 1) = 3 SetArr(1, 2) = 1 SetArr(1, 3) = 0 SetArr(1, 4) = 0 SetArr(2, 1) = 346 SetArr(2, 2) = 2 SetArr(2, 3) = 0 SetArr(2, 4) = 0 SetArr(3, 1) = 342 SetArr(3, 2) = 2 SetArr(3, 3) = 0 SetArr(3, 4) = 0 Set cvsApp = CreateObject("ACSUP.cvsApplication") Set cvsConn = CreateObject("ACSCN.cvsConnection") Set cvsSrv = CreateObject("ACSUPSRV.cvsServer") Set cvsSrv = cvsApp.Servers(1) sWarn = "" agents = "2402" Set AgMngObj = cvsSrv.AgentMgmt AgMngObj.AcdStartUp -1, "", cvsSrv.ServerKey, -1 AgMngObj.OleAgentSetSkill_R16_1 2, "" & agents & "", 1, 0, 0, 0, 3, SetArr, "" ' Getting Run Time error 9 Subscript out of range Set AgMngObj = Nothing Set cvsApp = Nothing Set cvsConn = Nothing Set cvsSrv = Nothing End Sub

Please Log in or Create an account to join the conversation.

More
9 years 8 months ago #406 by roller
For more than one agent use agents="2303;2402" not agents="2303;2402;" You do not need the ; after the last number - could that be your problem?

Please Log in or Create an account to join the conversation.

  • Tyger0951
  • Visitor
  • Visitor
9 years 8 months ago #407 by Tyger0951
Buhahahaha. Would have not guessed that extra ; would mess that up. That fixed it. Thank you very much

Please Log in or Create an account to join the conversation.

Time to create page: 1.161 seconds
Powered by Kunena Forum