Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CMS Scripting and variables

Status
Not open for further replies.

PRMiller

Technical User
Joined
Mar 18, 2004
Messages
95
Location
US
Good morning,

I'm writing a script to run a report and export data from Avaya (CMS Supervisor v11.0). I copied an old, working script and inserted several new lines of code.

The new code starts with the DIM statements and ends with END SELECT. When I try to execute the script, I receive the following error in my log: "[Line: 4] Expected end of statement."

The purpose of the new code is to allow the end-user to run the same report any month, any year, without having to change the dates within the report.

The problem appears to be with the "Dim" statements. Does Avaya use a different syntax for defining variables? Is this the right method?

Here's the script (I removed the servername here for security purposes):



'LANGUAGE=ENU
'SERVERNAME=
Public Sub Main()

Dim MyMonth As Integer
Dim MyYear As Integer
Dim RunDate As String

MyMonth = Month(Date)
Myyear= Year(Date)


Select Case MyMonth
Case 1
RunDate = MyMonth & "/01/" & MyYear & "--1"
Case 2
RunDate = MyMonth & "/01/" & MyYear & "--1"
Case 3
RunDate = MyMonth & "/01/" & MyYear & "--1"
Case 4
RunDate = MyMonth & "/01/" & MyYear & "--1"
Case 5
RunDate = MyMonth & "/01/" & MyYear & "--1"
Case 6
RunDate = MyMonth & "/01/" & MyYear & "--1"
Case 7
RunDate = MyMonth & "/01/" & MyYear & "--1"
Case 8
RunDate = MyMonth & "/01/" & MyYear & "--1"
Case 9
RunDate = MyMonth & "/01/" & MyYear & "--1"
Case 10
RunDate = MyMonth & "/01/" & MyYear & "--1"
Case 11
RunDate = MyMonth & "/01/" & MyYear & "--1"
Case 12
RunDate = MyMonth & "/01/" & MyYear & "--1"
End Select

On Error Resume Next

cvsSrv.Reports.ACD = 4
Set Info = cvsSrv.Reports.Reports("Historical\CMS custom\Agt Gp Productivity")

If Info Is Nothing Then
If cvsSrv.Interactive Then
MsgBox "The report Historical\CMS custom\Agt Gp Productivity was not found on ACD 4.", vbCritical Or vbOKOnly, "Avaya CMS Supervisor"
Else
Set Log = CreateObject("AVSERR.cvsLog")
Log.AutoLogWrite "The report Historical\CMS custom\Agt Gp Productivity was not found on ACD 4."
Set Log = Nothing
End If
Else

b = cvsSrv.Reports.CreateReport(Info,Rep)
If b Then

Rep.Window.Top = 2865
Rep.Window.Left = 3405
Rep.Window.Width = 8565
Rep.Window.Height = 5790



Rep.SetProperty "Agent Group","CALL CENTER"

Rep.SetProperty "Dates","RunDate"




b = Rep.ExportData("S:\Common\CallCntr\Employee Performance Evaluator\Data\-1\AgtGrpProdDataMTD.txt", 59, 0, True, False, True)





Rep.Quit


If Not cvsSrv.Interactive Then cvsSrv.ActiveTasks.Remove Rep.TaskID
Set Rep = Nothing
End If

End If
Set Info = Nothing

End Sub


Thanks,
Paul
 
Try adding the Case Else statement, I'm not sure if their implementation of VBA requires this.

Select Case MyMonth
Case 1
RunDate = MyMonth & "/01/" & MyYear & "--1"
Case Else
msgbox "here"
End Select

Also, I would make a new script from your Ver 11, and then add your lines of code into that one.

Let me know how you make out
Barry
 
Thanks Barry. We're working on another module this morning, but we're going to try that and some suggestions from the VBScript forum this afternoon. I'll let you know how it works.

Thanks again for the reply!
 
I'm not a developer at all, but when I've been trying to edit these scripts I found that any DIM statements in the scripts fail, instead just setting the value seemed to work ok.

Cheers,
NJ

PS: Please let me know if my advice has been of any use.
 
Thanks NJ. Your advice is in line with what others have said. Unfortunately, our system errors out if the variables aren't defined. Are you running your script from within Avaya? Are you running it outside Avaya (ie - double-clicking the script file itself in Explorer)? If you're running it outside Avaya, do you have Avaya running in the background?

Due to some time constraints on our project, we had to set up 24 different scripts, each with a date range specified to cover each of the next 24 months. This obviously isn't a permanent solution, but it'll have to serve as a stopgap until we can solve our variable problem.

Another question (and maybe I should post this in a separate thread): Two of us are developing a database with accompanying Avaya scripts. Each of us uses our own Avaya login code. Chris has created the 24 scripts mentioned above. Because she created them under her log-in, I can't run them. Not a big deal in development, but our end-users will have to run the scripts (either from a clickbuttone event within the database), or as a scheduled event.

How can we get around the problem of Avaya needing the proper user ID and password? Is there a statement we can place in the script circumvent this (preferably NOT one in which the id and password is revealed!)?

Thanks again,
Paul
 
The username/access for the scripts is specified under the CentreVu Supervisor options-->scripting menu. You can specify whichever account you want under this, so if you create 1 account that can run them and set all PC's to use that? The beauty is you can't see what the password is either.

I am running the scripts direct via double-clicking them in explorer.

See below; as I've said I'm not a programmer so the scripting is (I'm sure you'll see) very poor, however it does work.
-----------------------------------------------------------
'LANGUAGE=ENU
'SERVERNAME=172.19.34.19
Public Sub Main()


'##### SKILL 92

i_skill = inputbox ("Enter Skill To Export")
i_offset = "-"
i_dateval = "1"
i_date = i_offset & i_dateval
filename = i_skill & "_" & i_date & ".csv"
do until i_date = "-29"

On Error Resume Next

cvsSrv.Reports.ACD = 1
Set Info = cvsSrv.Reports.Reports("Historical\Split/Skill\Summary Interval")

If Info Is Nothing Then
If cvsSrv.Interactive Then
MsgBox "The report Historical\Split/Skill\Summary Interval was not found on ACD 1.", vbCritical Or vbOKOnly, "CentreVu Supervisor"
Else
Set Log = CreateObject("CVSERR.cvsLog")
Log.AutoLogWrite "The report Historical\Split/Skill\Summary Interval was not found on ACD 1."
Set Log = Nothing
End If
Else



b = cvsSrv.Reports.CreateReport(Info,Rep)
If b Then

Rep.Window.Top = 3360
Rep.Window.Left = 4485
Rep.Window.Width = 12375
Rep.Window.Height = 8610

Rep.SetProperty "Split/Skill",i_skill

Rep.SetProperty "Date",i_date

Rep.SetProperty "Times","08:00-20:30"

b = Rep.ExportData("D:\Documents and Settings\nathan.james\My Documents\Work\PAS Trend Report\" & filename, 44, 1, False, False, True)


Rep.Quit

If Not cvsSrv.Interactive Then cvsSrv.ActiveTasks.Remove Rep.TaskID
Set Rep = Nothing
End If

End If


Set Info = Nothing
'## cvs_cmd_end
i_dateval=i_dateval + 1
i_date = i_offset & i_dateval
filename = i_skill & "_" & i_date & ".csv"
loop
msgbox "Skill " & i_skill & " Export Complete."
End Sub
-----------------------------------------------------------

Also don't forget that you can still use the 0, -1, -2 etc for dates!


Cheers,
NJ

PS: Please let me know if my advice has been of any use.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top