Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Donate Today!

Do you enjoy these
technical forums?
Donate Today! Click Here

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Rcotten (MIS)
8 Jun 04 15:46
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
Helpful Member!  Rcotten (MIS)
9 Jun 04 15:43
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
cti1291 (Programmer)
10 Jun 04 15:40
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

Rcotten (MIS)
10 Jun 04 16:01
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
MathewRT (IS/IT--Management)
13 Jul 04 14:46
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!

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close