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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CMS Supervisor auto scripts 1

Status
Not open for further replies.

Rcotten

MIS
Jan 29, 2002
46
US
I know you can create scripts in CMS Supervisor but is there some way (VBA?) to have that script run a range of data for you?

Here is my script... What I want to do is have it read a list of agent ids from a txt file by changing the Rep.SetProperty values.

Any thoughts on this?

Thank you,

Ray


'LANGUAGE=ENU
'SERVERNAME=XXXX.XXXX.com
Public Sub Main()

'## cvs_cmd_begin
'## ID = 2001
'## Description = "Report: Historical: CMS custom: ACC AGENT REPORT: Print"
'## Parameters.Add "Report: Historical: CMS custom: ACC AGENT REPORT: Print","_Desc"
'## Parameters.Add "Reports","_Catalog"
'## Parameters.Add "5","_Action"
'## Parameters.Add "1","_Quit"
'## Parameters.Add "Historical\CMS custom\ACC AGENT REPORT","_Report"
'## Parameters.Add "1","_ACD"
'## Parameters.Add "4785","_Top"
'## Parameters.Add "780","_Left"
'## Parameters.Add "18465","_Width"
'## Parameters.Add "6885","_Height"
'## Parameters.Add "The report Historical\CMS custom\ACC AGENT REPORT was not found on ACD 1.","_ReportNotFound"
'## Parameters.Add "*","_BeginProperties"
'## Parameters.Add "8061","Agent"
'## Parameters.Add "05/01/04-05/31/04","Dates"
'## Parameters.Add "*","_EndProperties"
'## Parameters.Add "*","_BeginViews"
'## Parameters.Add "*","_EndViews"

On Error Resume Next

cvsSrv.Reports.ACD = 1
Set Info = cvsSrv.Reports.Reports("Historical\CMS custom\ACC AGENT REPORT")

If Info Is Nothing Then
If cvsSrv.Interactive Then
MsgBox "The report Historical\CMS custom\ACC AGENT REPORT was not found on ACD 1.", vbCritical Or vbOKOnly, "CentreVu Supervisor"
Else
Set Log = CreateObject("CVSERR.cvsLog")
Log.AutoLogWrite "The report Historical\CMS custom\ACC AGENT REPORT was not found on ACD 1."
Set Log = Nothing
End If
Else

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

Rep.Window.Top = 4785
Rep.Window.Left = 780
Rep.Window.Width = 18465
Rep.Window.Height = 6885



Rep.SetProperty "Agent","8061"

Rep.SetProperty "Dates","05/01/04-05/31/04"




b = Rep.PrintReport





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

End Sub
 
Well I'll reply to my own thread so if anyone else comes looking for this info they will have it.

CMS Supervisor uses VBSCRIPT in its .csvauto files.

Here is the script I wrote that will read in a text file line for line and run a CMS report for each agent id. This report points to a Custom CMS report but you can adapt it to point to any others.


'Ray Cotten 6/9/04
'VBSCRIPT to run CMS reports for Accucheck
'Reads 1st line of agents.txt to get date range for report
'Reads the rest of agents.txt into v array
'Run CMS Supervisor report ACC AGENT REPORT for each agent id
'Last line of agents.txt should be 9999 to exit program
'agents.txt should be located in the same directory at this *.cvsauto file
'Use cvs.log in the centervu directory to troubleshoot issues
'
'syntax of agents.txt file should be first line date range all other
'lines agent id's. Last line must equal 9999.
'
'05/01/04-05/31/04
'5359
'5023
'5378
'8055
'9999
'


'Environment variables need to run CMS reports
'LANGUAGE=ENU
'SERVERNAME=YOURCMSSERVER.COM


Public Sub Main()

l=0 'loop value for read loop
i=0 'loop value for printing loop

dim date 'value for date range
dim v(999) 'define array. All data is read into this from agents.txt
dim fs, f 'define filesystem stuff for read

cvsSrv.Reports.ACD = 1

Set Info = cvsSrv.Reports.Reports("Historical\CMS custom\ACC AGENT REPORT")

'Reads file one line at a time into v array

Set fs=CreateObject("Scripting.FileSystemObject")
Set f=fs.OpenTextFile("agents.txt", 1)
date = f.ReadLine
Do While f.AtEndOfStream <> True
v(l) = f.ReadLine
l=l+1
Loop 'keep reading in data until EOF hit.

f.Close 'close agents.txt file

Set f=Nothing 'clear f and fs
Set fs=Nothing

'Print report via CMS Supervisor

Do while v(i) < 9999 'run until last line of agents.txt is 9999
b = cvsSrv.Reports.CreateReport(Info,Rep)


Rep.Window.Top = 4785
Rep.Window.Left = 780
Rep.Window.Width = 18465
Rep.Window.Height = 6885

Rep.SetProperty "Agent",v(i) 'defines agent id to run on

Rep.SetProperty "Dates",date 'defines the date range

b = Rep.PrintReport

Rep.Quit

i=i+1 'add one to count i so we get the next agent id

loop 'keep printing CMS reports


end Sub



Enjoy,

Ray
 
Hi Ray,
Very good solution.
If you don't mind I ask:
where can i find the options avaya has in order to code the report?
Example,
cvsSrv.Reports.reports
cvsSrv.Reports.createreports
cvsSrv.Interactive
Where can find then different options cvssrv has and the parameters I can code in order to personalize my scripts?

Hope my question makes sense.
Thanks in advance to any answer you can provide.
Regards

 
Unfortunately that is not documented anywhere (at least that I can find).

In CMS supervisor just run several different reports and save them as auto scripts. Then you can look inside them and see what they do. I know there are VBS commands available for exporting files, etc... so I imagine there are quite a few for cvsSrv.

Good luck!

Ray
 
I have a different solution. Use this as a public function:

Option Explicit

Private Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As _
String, ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Function Shell(Program As String, Optional ShowCmd As Long = _
vbNormalNoFocus, Optional ByVal WorkDir As Variant) As Long

Dim FirstSpace As Integer, Slash As Integer

If Left(Program, 1) = """" Then
FirstSpace = InStr(2, Program, """")


If FirstSpace <> 0 Then
Program = Mid(Program, 2, FirstSpace - 2) & _
Mid(Program, FirstSpace + 1)
FirstSpace = FirstSpace - 1
End If

Else
FirstSpace = InStr(Program, " ")
End If

If FirstSpace = 0 Then FirstSpace = Len(Program) + 1

If IsMissing(WorkDir) Then

For Slash = FirstSpace - 1 To 1 Step -1
If Mid(Program, Slash, 1) = "\" Then Exit For
Next

If Slash = 0 Then
WorkDir = CurDir
ElseIf Slash = 1 Or Mid(Program, Slash - 1, 1) = ":" Then
WorkDir = Left(Program, Slash)
Else
WorkDir = Left(Program, Slash - 1)
End If

End If

Shell = ShellExecute(0, vbNullString, _
Left(Program, FirstSpace - 1), LTrim(Mid(Program, _
FirstSpace)), WorkDir, ShowCmd)
If Shell < 32 Then VBA.Shell Program, ShowCmd 'To raise Error

End Function


Then easily as:

Sub CVScriptsUpdate()
'
Call Shell("blah.cvs")

End Sub

And Voila... Done... I can't remember where I got the function from (I wish I could take acolades), but it will essentially allow you to run any program / script etc!!

Enjoy!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top