All,
I have recieved plenty of help from this forum, so I thought that I would give something back. For any of you who work in a DMS 100/500 this may be handy. I have created a script that will calculate the password of the day and activate the CallTrak tool. It may be a little bulky, so feel free to edit as you please, but it does work as is. All it leaves to you is to actually start the msgtrace. Well here it is, enjoy. Please let me know if you like it.
string SwitchDate,DayOfWeek,DayOfWeek1,DayOfMonth1,DayOfMonth2,MonthAlpha
string MonthNum,MonthNum1,MonthNum2,Year1,Year2,Year3,Year4
string CMonthNum1,CMonthNum2,CDayOfMonth1,CDayOfMonth2,CYear1
string CYear2,CYear3,CYear4,POD,Trunk,Trunk1,DN,DN1,Len,Len1,Ltid,Ltid1
integer IMonthNum1,IMonthNum2,IDayOfMonth1,IDayOfMonth2,IYear1,IYear2
integer IYear3,IYear4,Event,TrunkCheckbox,DNCheckbox,LenCheckbox
integer CIMonthNum1,CIMonthNum2,CIDayOfMonth1,CIDayOfMonth2
integer CIYear1,CIYear2,CIYear3,CIYear4,LtidCheckbox,QuitCheckbox
proc main
UserSelectionDialog()
if QuitCheckbox != 0
goto endprog
endif
transmit "quit all ^M"
waitfor ">"
RetriveDate()
ParseString()
CalculatePOD()
ActivateCalltrak()
AccessCalltrak()
if TrunkCheckbox != 0
TrunkCalltrak()
elseif DNCheckbox != 0
DNCalltrak()
elseif LenCheckbox != 0
LenCalltrak()
elseif LtidCheckbox != 0
LtidCalltrak()
endif
pause 1
endprog:
endproc
proc RetriveDate
transmit "date ^M"
set aspect RXDATA ON
pause 1
comread SwitchDate 43
set aspect RXDATA OFF
;usermsg "%s" SwitchDate
endproc
proc ParseString
substr DayOfWeek SwitchDate 16 3
if strfind DayOfWeek "MON"
DayOfWeek1 = "LNM"
elseif strfind DayOfWeek "TUE"
DayOfWeek1 = "STD"
elseif strfind DayOfWeek "WED"
DayOfWeek1 = "VDC"
elseif strfind DayOfWeek "THU"
DayOfWeek1 = "SGT"
elseif strfind DayOfWeek "FRI"
DayOfWeek1 = "EQH"
elseif strfind DayOfWeek "SAT"
DayOfWeek1 = "RZS"
elseif strfind DayOfWeek "SUN"
DayOfWeek1 = "RTM"
endif
substr DayOfMonth1 SwitchDate 22 1
substr DayOfMonth2 SwitchDate 23 1
atoi DayOfMonth1 IDayOfMonth1
atoi DayOfMonth2 IDayOfMonth2
;usermsg "%d%d" IDayOfMonth1 IDayOfMonth2
substr MonthAlpha SwitchDate 25 3
if strfind MonthAlpha "JAN"
MonthNum = "01"
elseif strfind MonthAlpha "FEB"
MonthNum = "02"
elseif strfind MonthAlpha "MAR"
MonthNum = "03"
elseif strfind MonthAlpha "APR"
MonthNum = "04"
elseif strfind MonthAlpha "MAY"
MonthNum = "05"
elseif strfind MonthAlpha "JUN"
MonthNum = "06"
elseif strfind MonthAlpha "JUL"
MonthNum = "07"
elseif strfind MonthAlpha "AUG"
MonthNum = "08"
elseif strfind MonthAlpha "SEP"
MonthNum = "09"
elseif strfind MonthAlpha "OCT"
MonthNum = "10"
elseif strfind MonthAlpha "NOV"
MonthNum = "11"
elseif strfind MonthAlpha "DEC"
MonthNum = "12"
endif
substr MonthNum1 MonthNum 0 1
substr MonthNum2 MonthNum 1 1
atoi MonthNum1 IMonthNum1
atoi MonthNum2 IMonthNum2
;usermsg "%d%d" IMonthNum1 IMonthNum2
substr Year1 SwitchDate 29 1
substr Year2 SwitchDate 30 1
substr Year3 SwitchDate 31 1
substr Year4 SwitchDate 32 1
atoi Year1 IYear1
atoi Year2 IYear2
atoi Year3 IYear3
atoi Year4 IYear4
;usermsg "%d%d%d%d" IYear1 IYear2 IYear3 IYear4
endproc
proc CalculatePOD
if IYear4 != 0
CIYear4 = 10-IYear4
endif
if Iyear3 != 0
CIYear3 = 10-IYear3
endif
if IYear2 != 0
CIYear2 = 10-IYear2
endif
if IYear1 != 0
CIYear1 = 10-IYear1
endif
if IDayOfMonth2 != 0
CIDayOfMonth2 = 10-IDayOfMonth2
endif
if IDayOfMonth1 != 0
CIDayOfMonth1 = 10-IDayOfMonth1
endif
if IMonthNum2 != 0
CIMonthNum2 = 10-ImonthNum2
endif
if IMonthNum1 != 0
CIMonthNum1 = 10-ImonthNum1
endif
itoa CIyear4 CYear4
itoa CIyear3 CYear3
itoa CIyear2 CYear2
itoa CIyear1 CYear1
itoa CIDayOfMonth2 CDayOfMonth2
itoa CIDayOfMonth1 CDayOfMonth1
itoa CIMonthNum2 CMonthNum2
itoa CIMonthNum1 CMonthNum1
strfmt POD "%s%s%s%s%s%s%s%s%s" CYear4 CYear3 CYear2 CYear1 CMonthNum2 CMonthNum1 CDayOfMonth2 CDayOfMonth1 DayOfWeek1
;usermsg "%s" POD
endproc
proc ActivateCalltrak
transmit "toolsup ^M"
waitfor ">"
transmit "access on calltrak ^M"
waitfor "Enter Password:"
waitfor ">"
transmit POD
transmit "^M"
transmit "quit ^M"
endproc
proc UserSelectionDialog
dialogbox 0 96 35 264 169 3 "CallTrak"
pushbutton 1 60 140 40 13 "GO!!!!" OK DEFAULT
editbox 2 88 48 134 11 Trunk
editbox 3 88 69 134 11 DN
editbox 4 88 88 136 11 Len
editbox 5 88 109 136 11 Ltid
checkbox 6 39 48 42 11 "Trunk" TrunkCheckbox
checkbox 7 39 67 42 11 "DN" DNCheckbox
checkbox 8 39 88 42 11 "Len" LenCheckbox
checkbox 9 39 109 42 11 "Ltid" LtidCheckbox
checkbox 10 129 141 42 11 "Quit" QuitCheckbox
text 17 56 17 150 11 "Please Select Type of Calltrak and Termination" left
enddialog
while 1
dlgevent 0 Event ; Get dialog event.
switch Event ; Evaluate dialog event.
case 0 ; No event occurred.
endcase
case 1 ; Button was pressed.
exitwhile ; Exit the while loop.
endcase
endswitch
endwhile
dlgdestroy 0 CANCEL ; Get rid of dialog box.
endproc
proc AccessCalltrak
transmit "calltrak ^M"
waitfor "CALLTRAK:" 4
if FAILURE
goto endprog
endif
waitfor ">"
transmit "msgtrace on;msgtrace bufsize short 230 long 65 ^M"
waitfor ">"
endprog:
endproc
proc TrunkCalltrak
strfmt Trunk1 "select trk %s ^M" Trunk
transmit Trunk1
waitfor ">"
endproc
proc DNCalltrak
strfmt DN1 "select dn %s ^M" DN
transmit DN1
waitfor ">"
endproc
proc LenCalltrak
strfmt Len1 "select len %s ^M" Len
transmit Len1
waitfor ">"
endproc
proc LtidCalltrak
strfmt Ltid1 "select ltid %s ^M" Ltid
transmit Ltid1
waitfor ">"
endproc
I have recieved plenty of help from this forum, so I thought that I would give something back. For any of you who work in a DMS 100/500 this may be handy. I have created a script that will calculate the password of the day and activate the CallTrak tool. It may be a little bulky, so feel free to edit as you please, but it does work as is. All it leaves to you is to actually start the msgtrace. Well here it is, enjoy. Please let me know if you like it.
string SwitchDate,DayOfWeek,DayOfWeek1,DayOfMonth1,DayOfMonth2,MonthAlpha
string MonthNum,MonthNum1,MonthNum2,Year1,Year2,Year3,Year4
string CMonthNum1,CMonthNum2,CDayOfMonth1,CDayOfMonth2,CYear1
string CYear2,CYear3,CYear4,POD,Trunk,Trunk1,DN,DN1,Len,Len1,Ltid,Ltid1
integer IMonthNum1,IMonthNum2,IDayOfMonth1,IDayOfMonth2,IYear1,IYear2
integer IYear3,IYear4,Event,TrunkCheckbox,DNCheckbox,LenCheckbox
integer CIMonthNum1,CIMonthNum2,CIDayOfMonth1,CIDayOfMonth2
integer CIYear1,CIYear2,CIYear3,CIYear4,LtidCheckbox,QuitCheckbox
proc main
UserSelectionDialog()
if QuitCheckbox != 0
goto endprog
endif
transmit "quit all ^M"
waitfor ">"
RetriveDate()
ParseString()
CalculatePOD()
ActivateCalltrak()
AccessCalltrak()
if TrunkCheckbox != 0
TrunkCalltrak()
elseif DNCheckbox != 0
DNCalltrak()
elseif LenCheckbox != 0
LenCalltrak()
elseif LtidCheckbox != 0
LtidCalltrak()
endif
pause 1
endprog:
endproc
proc RetriveDate
transmit "date ^M"
set aspect RXDATA ON
pause 1
comread SwitchDate 43
set aspect RXDATA OFF
;usermsg "%s" SwitchDate
endproc
proc ParseString
substr DayOfWeek SwitchDate 16 3
if strfind DayOfWeek "MON"
DayOfWeek1 = "LNM"
elseif strfind DayOfWeek "TUE"
DayOfWeek1 = "STD"
elseif strfind DayOfWeek "WED"
DayOfWeek1 = "VDC"
elseif strfind DayOfWeek "THU"
DayOfWeek1 = "SGT"
elseif strfind DayOfWeek "FRI"
DayOfWeek1 = "EQH"
elseif strfind DayOfWeek "SAT"
DayOfWeek1 = "RZS"
elseif strfind DayOfWeek "SUN"
DayOfWeek1 = "RTM"
endif
substr DayOfMonth1 SwitchDate 22 1
substr DayOfMonth2 SwitchDate 23 1
atoi DayOfMonth1 IDayOfMonth1
atoi DayOfMonth2 IDayOfMonth2
;usermsg "%d%d" IDayOfMonth1 IDayOfMonth2
substr MonthAlpha SwitchDate 25 3
if strfind MonthAlpha "JAN"
MonthNum = "01"
elseif strfind MonthAlpha "FEB"
MonthNum = "02"
elseif strfind MonthAlpha "MAR"
MonthNum = "03"
elseif strfind MonthAlpha "APR"
MonthNum = "04"
elseif strfind MonthAlpha "MAY"
MonthNum = "05"
elseif strfind MonthAlpha "JUN"
MonthNum = "06"
elseif strfind MonthAlpha "JUL"
MonthNum = "07"
elseif strfind MonthAlpha "AUG"
MonthNum = "08"
elseif strfind MonthAlpha "SEP"
MonthNum = "09"
elseif strfind MonthAlpha "OCT"
MonthNum = "10"
elseif strfind MonthAlpha "NOV"
MonthNum = "11"
elseif strfind MonthAlpha "DEC"
MonthNum = "12"
endif
substr MonthNum1 MonthNum 0 1
substr MonthNum2 MonthNum 1 1
atoi MonthNum1 IMonthNum1
atoi MonthNum2 IMonthNum2
;usermsg "%d%d" IMonthNum1 IMonthNum2
substr Year1 SwitchDate 29 1
substr Year2 SwitchDate 30 1
substr Year3 SwitchDate 31 1
substr Year4 SwitchDate 32 1
atoi Year1 IYear1
atoi Year2 IYear2
atoi Year3 IYear3
atoi Year4 IYear4
;usermsg "%d%d%d%d" IYear1 IYear2 IYear3 IYear4
endproc
proc CalculatePOD
if IYear4 != 0
CIYear4 = 10-IYear4
endif
if Iyear3 != 0
CIYear3 = 10-IYear3
endif
if IYear2 != 0
CIYear2 = 10-IYear2
endif
if IYear1 != 0
CIYear1 = 10-IYear1
endif
if IDayOfMonth2 != 0
CIDayOfMonth2 = 10-IDayOfMonth2
endif
if IDayOfMonth1 != 0
CIDayOfMonth1 = 10-IDayOfMonth1
endif
if IMonthNum2 != 0
CIMonthNum2 = 10-ImonthNum2
endif
if IMonthNum1 != 0
CIMonthNum1 = 10-ImonthNum1
endif
itoa CIyear4 CYear4
itoa CIyear3 CYear3
itoa CIyear2 CYear2
itoa CIyear1 CYear1
itoa CIDayOfMonth2 CDayOfMonth2
itoa CIDayOfMonth1 CDayOfMonth1
itoa CIMonthNum2 CMonthNum2
itoa CIMonthNum1 CMonthNum1
strfmt POD "%s%s%s%s%s%s%s%s%s" CYear4 CYear3 CYear2 CYear1 CMonthNum2 CMonthNum1 CDayOfMonth2 CDayOfMonth1 DayOfWeek1
;usermsg "%s" POD
endproc
proc ActivateCalltrak
transmit "toolsup ^M"
waitfor ">"
transmit "access on calltrak ^M"
waitfor "Enter Password:"
waitfor ">"
transmit POD
transmit "^M"
transmit "quit ^M"
endproc
proc UserSelectionDialog
dialogbox 0 96 35 264 169 3 "CallTrak"
pushbutton 1 60 140 40 13 "GO!!!!" OK DEFAULT
editbox 2 88 48 134 11 Trunk
editbox 3 88 69 134 11 DN
editbox 4 88 88 136 11 Len
editbox 5 88 109 136 11 Ltid
checkbox 6 39 48 42 11 "Trunk" TrunkCheckbox
checkbox 7 39 67 42 11 "DN" DNCheckbox
checkbox 8 39 88 42 11 "Len" LenCheckbox
checkbox 9 39 109 42 11 "Ltid" LtidCheckbox
checkbox 10 129 141 42 11 "Quit" QuitCheckbox
text 17 56 17 150 11 "Please Select Type of Calltrak and Termination" left
enddialog
while 1
dlgevent 0 Event ; Get dialog event.
switch Event ; Evaluate dialog event.
case 0 ; No event occurred.
endcase
case 1 ; Button was pressed.
exitwhile ; Exit the while loop.
endcase
endswitch
endwhile
dlgdestroy 0 CANCEL ; Get rid of dialog box.
endproc
proc AccessCalltrak
transmit "calltrak ^M"
waitfor "CALLTRAK:" 4
if FAILURE
goto endprog
endif
waitfor ">"
transmit "msgtrace on;msgtrace bufsize short 230 long 65 ^M"
waitfor ">"
endprog:
endproc
proc TrunkCalltrak
strfmt Trunk1 "select trk %s ^M" Trunk
transmit Trunk1
waitfor ">"
endproc
proc DNCalltrak
strfmt DN1 "select dn %s ^M" DN
transmit DN1
waitfor ">"
endproc
proc LenCalltrak
strfmt Len1 "select len %s ^M" Len
transmit Len1
waitfor ">"
endproc
proc LtidCalltrak
strfmt Ltid1 "select ltid %s ^M" Ltid
transmit Ltid1
waitfor ">"
endproc