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

Controlling CentreVue Supervisor with VBA code 1

Status
Not open for further replies.

Danp129

Technical User
Nov 20, 2001
143
0
0
US
Hi all, before I spend allot if time trying to figure this out, I thought I'd ask if anyone knows how to tell CVS to connect and login to CMS using VB code.

I can get CVS to run a report using VBA code (macro in Excel), but I have to be logged into the CMS with CVS first. Does anyone have example code of telling CVS to connect and login?
 
Easiest way to do this is probably through some macro program, i.e. MacroAngel or Automate, that has VB hooks. So the VB program controls the macro program which controls the CentreVue program. Personally, I like MacroAngel better (more stable).
 
Thanks for your reply. The Macro Angel program looks pretty cool, I will try it sometime. For this project however, I would like to do it in all VB code. Third party tools that cost money are not an option at this point. I know I could write VB code to "Sendkeys" but I'd like to use the CVS classes instead.
 
Danp129,
I have used access to grab trunk group reports using Terranova and DDE. But I could only grab one page reports Terranova does not use the sendkey command so I cant page-down or cancel. I was not aware CentreVu Supervisor allowed DDE?? Connections. If so what reference are you using to initiate you connection with? Where could I get a list of commands? Does CentreVu Terminal also accept DDE?

Here is the code I wrote to log into my phone switch maybe you could port it over. This code uses two text boxes in an access form LoginID and Password.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Private Sub Command2_Click()
Dim info As String, Login As String, Pass As String, chan As String, Count As String

Login = LoginID
Pass = Password

On Error Resume Next ' Set up error handling.
chan = DDEInitiate("TCOM", "COM1") ' Establish link.
If Err Then ' If error occurs, TCOM may not be running.
Err = 0 ' Reset error
Shell "C:\TC\BIN\TCOM.EXE", 1 ' Start TCOM.
If Err Then Exit Sub ' If another error, exit.
chan = DDEInitiate("TCOM", "COM1") ' Establish TCOM link.
End If

DDEExecute chan, "[MACROS 'PBXnoLO.scr']" ' Run Script to configure TCOM.

Count = 1

DDEPoke chan, "SEND", "" & Login ' Send LoginID

While Count < 10000
On Error Resume Next ' Counter waits for password prompt
Count = Count + 1
Wend



DDEPoke chan, &quot;SEND&quot;, &quot;&quot; & Pass ' Send Password
Count = 1

While Count < 10000
On Error Resume Next ' Counter waits for Terminal prompt
Count = Count + 1
Wend

DDEPoke chan, &quot;SEND&quot;, &quot;&quot;
DDEPoke chan, &quot;SEND&quot;, &quot;&quot;
DDEPoke chan, &quot;SEND&quot;, &quot;&quot;
DDETerminate (chan)
End Sub

+++++++++++++++++++++++++++++++++++++++++++++++++
PBXnoLO.scr Configures my Emulator itlooks like this.
+++++++++++++++++++++++++++++++++++++++++++++++++

BAUD 9600
PARITY NONE
WORDSZ 8
STOPBIT 1
S_HANDSHAKE XON/XOFF dc1 dc3
DELAY_BAUD 9600
SETBREAK 50
DUPLEX FULL
EMULATOR 513
REM_CMD ON
WRAPAROUND OFF
COLORS BKG(0,64,64) NORM(255,255,255) BLINK(255,255,255) BRIGHT(255,255,255) SUBD(255,255,255)
PROTOCOL TERRANOVA_B
PROTO_ESC 13 27
DEVICE &quot;HAYES&quot;
DIAL &quot;?????&quot; <-****Enter number here
WAIT 4 &quot;login: &quot;
STOP

++++++++++++++++++++++++++++++++++++++++++++++++++

Sorry about the formatting I will Email it to you if its a pain to read. Its not the best code I've written, but it gets the job done.

VLG711
 
The last time I used Terranova, it didn't support telnet so I abondoned it (have a CLAN and like to take advantage of it). I haven't used the newest terminal emulator that comes with DSA 1.10, I've heard is suppports scripting, but not VB scripting.

I use Reflection for any special exports from my switch that DSA doesn't support (like exporting every step in every vector saving it to Excel, then to Word and saving as HTML with links). I'll send you the code for this if you want to download the WRQ Reflection for Unix/Open VMS evaluation.

After manually logging into CetreVu Supervisor, I can run CMS reports using VB programming from Excel. I'll send you the spreedsheet for this code that pulls CMS trace reports and exports them as files (you could also copy to clip board and paste the info to another sheet or print them if you change a little code). It'll make more sense if you see the spreadsheet. Note that the index number for a single report could be found with very little code instead of using the &quot;RefreshCatalogindex&quot; sub, but I lost the command for that :( .. E-mail me at dan129<spamfilter>@swbell.net and I'll send you the spreadsheet that is used for this code. Here's the code (to give you an Idea of how I'm controlling it, it's useless without the spreadsheet)...


Public rpttype, IndexNum, ReportLocation As Range
Public CentreVuOpen As Integer
Dim Adtlfntxt, Counter1, DateOffset, ExportDir, AgentID, AgentName, TimeFrame As String
Sub ExportAgentTrace()

Call RefreshCatalogIndex 'If a report is added or deleted, the index number may change

On Error GoTo StopReports
Dim cvsApp As New cvsApplication
Dim cvsSrv As New cvsServer
Dim cvsCatalog As New cvsCatalog
Dim cvsRpt As New cvsReport
Set cvsApp = CreateObject(&quot;cvsup.cvsApplication&quot;)

CentreVuOpen = cvsApp.Servers.Count

If (CentreVuOpen > 0) Then
Set cvsSrv = cvsApp.Servers.Item(1)
Else
GoTo StopReports
End If

Set cvsCatalog = cvsSrv.Reports
cvsSrv.Reports.ACD = 1

'Set Variables

'Adtlfntxt, DateOffset, ExportDirectory, AgentID, AgentName,
'TimeOffset, IndexNumber are named ranges in Excel

IndexNum = Range(Range(&quot;IndexNumber&quot;).Address).Offset(1, 0).Value
ExportDir = Range(&quot;ExportDirectory&quot;).Value
DateOffset = Range(&quot;DateOffset&quot;).Value
TimeFrame = Range(&quot;TimeFrame&quot;).Value
Adtlfntxt = Range(&quot;AdtlFnTxt&quot;).Value 'Additional info added to filename (currently the Date + DateOffset)
Counter1 = 0

'Start the loop
Do Until Range(&quot;AgentID&quot;).Offset(Counter1 + 1, 0).Value = &quot;&quot; 'If there are no more Agent ID's, the loop will stop.

'increase counter
Counter1 = Counter1 + 1

'reset varibles based on new counter value
AgentID = Range(&quot;AgentID&quot;).Offset(Counter1, 0).Value 'Used to fill in value on the report (and currently part of the file name).
AgentName = Range(&quot;AgentName&quot;).Offset(Counter1, 0).Value 'Currently used as part of the filename

'open the report
cvsCatalog.CreateReport cvsCatalog.Reports.Item(IndexNum), cvsRpt

'Input values on the form
If (cvsRpt.SetProperty(&quot;Agent&quot;, AgentID) And _
cvsRpt.SetProperty(&quot;Dates&quot;, DateOffset) And _
cvsRpt.SetProperty(&quot;Times&quot;, TimeFrame)) Then
Else
GoTo StopReports
End If

'Run the report
cvsRpt.Run

'What to do with the report, i.e. Export, Copy Values, Print, and if an Export, what directory/filename.
'Record a script withing CVS, open it with notepad and compare
'the line that starts with b = to the following line:
cvsRpt.ExportData ExportDir & &quot;\&quot; & AgentID & &quot; - &quot; & AgentName & Adtlfntxt & &quot;.txt&quot;, 44, 1, False, True, True

'Close the report
cvsRpt.Quit
Loop

Set cvsRpt = Nothing
Set cvsCatalog = Nothing
Set cvsSrv = Nothing
Set cvsApp = Nothing
Exit Sub

StopReports:
Set cvsRpt = Nothing
Set cvsCatalog = Nothing
Set cvsSrv = Nothing
Set cvsApp = Nothing

End Sub
Sub RefreshCatalogIndex()

Application.Calculation = xlManual
Sheets(&quot;Report Catalog&quot;).Select
Range(&quot;A1:A500&quot;).ClearContents
On Error GoTo StopReports
Dim CentreVuOpen As Integer
Dim cvsApp As New cvsApplication
Dim cvsSrv As New cvsServer
Dim cvsCatalog As New cvsCatalog
Dim cvsRpt As New cvsReport
Dim cellnum As Integer

Set cvsApp = CreateObject(&quot;cvsup.cvsApplication&quot;)

CentreVuOpen = cvsApp.Servers.Count
If (CentreVuOpen > 0) Then
Set cvsSrv = cvsApp.Servers.Item(1)
Else
GoTo StopReports
End If

Set cvsCatalog = cvsSrv.Reports
cvsSrv.Reports.ACD = 1

cellnum = 0
Do
cellnum = cellnum + 1
Excel.Application.Range(&quot;a&quot; & cellnum).Value = cvsCatalog.Reports(cellnum).Key
Loop Until cellnum = cvsCatalog.Reports.Count
Sheets(&quot;Metric Reports&quot;).Select
Application.Calculation = xlAutomatic
on_exit:
Set cvsRpt = Nothing
Set cvsCatalog = Nothing
Set cvsSrv = Nothing
Set cvsApp = Nothing
Exit Sub

StopReports:
Set cvsRpt = Nothing
Set cvsCatalog = Nothing
Set cvsSrv = Nothing
Set cvsApp = Nothing

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top