I am new to aspect and am in need of help. I am trying to fix this code that I inherited (downsizing) and am trying to make it work. I have 2 problems
1. Is that the user input fot log interval doesn't work
2. Is stopping the script when it is waiting for the next scan. I managed to manually enter a interval (60) and the log interval scans every minute.
Here is the code:
#define TRUE 1
proc main
string sIPAddress,sLogInterval
integer Event
dialogbox 0 52 18 231 59 2 "Telnet Input..."
editbox 7 138 2 44 12 sLogInterval
editbox 3 137 22 68 12 sIPAddress
pushbutton 4 118 40 52 12 "OK" OK DEFAULT
pushbutton 5 56 40 52 12 "Cancel" CANCEL
text 9 76 24 52 12 "IP Address -->" right
text 2 2 5 132 13 "Please Enter Log Interval (in seconds) -->" left
enddialog
while TRUE
dlgevent 0 Event
switch Event
case 4
login(sIPAddress)
;call additional procedures here
endcase
case -1
case 5
exitwhile
endcase
endswitch
endwhile
dlgdestroy 0 CANCEL
endproc
;***************************************************************************
proc login
param string sIPAddress
string sIPaddr
waitforit:
strfmt sIPAddr "%s^M^M" sIPAddress
transmit sIPAddr
dialnumber TELNET sIPAddress
pause 1
transmit "^M"
Waitfor "Enter Level: "
transmit "2^M"
transmit "^M" ;brings you to main menu
transmit "5" ;brings you to alarms menu
transmit "1" ;outstanding alarms
transmit "5" ;all_alarms
more1:
If waitfor "Bottom of display has been reached." 2
pause 1
transmit "7" ;more...
transmit "3" ;sub-set
transmit "1" ;all
Else
transmit "2" ;page_down
goto more1
EndIf
more2:
If waitfor "Bottom of display has been reached." 2
pause 1
transmit "9" ;quit
transmit "9" ;quit
Disconnect
Call Timefunction
goto waitforit
Else
transmit "2" ;page_down
goto more2
EndIf
Endproc
;***************************************************************************
Proc Timefunction
string ThisTime
integer Event
long TimeNum,NextTimeNum
ThisTime = $Time24
strsltime $DATE ThisTime TimeNum ;converts a date & time string to a long variable
NextTimeNum = TimeNum + 60 ;Waiting for minute
pause 1
Clear
dialogbox 0 112 34 162 80 3 "Wait...."
text 3 25 25 124 22 "Waiting 1 minute before next reading..." left
editbox 4 87 8 34 12 ThisTime
text 5 25 9 58 11 "Last reading was at :" left
pushbutton 6 52 52 56 14 "Stop" CANCEL
enddialog
while TRUE
dlgevent 0 Event
switch Event
case 6
waituntil NextTimeNum
endcase
case 7
exitwhile
endcase
endswitch
endwhile
dlgdestroy 0 CANCEL
endproc
Thank you.
1. Is that the user input fot log interval doesn't work
2. Is stopping the script when it is waiting for the next scan. I managed to manually enter a interval (60) and the log interval scans every minute.
Here is the code:
#define TRUE 1
proc main
string sIPAddress,sLogInterval
integer Event
dialogbox 0 52 18 231 59 2 "Telnet Input..."
editbox 7 138 2 44 12 sLogInterval
editbox 3 137 22 68 12 sIPAddress
pushbutton 4 118 40 52 12 "OK" OK DEFAULT
pushbutton 5 56 40 52 12 "Cancel" CANCEL
text 9 76 24 52 12 "IP Address -->" right
text 2 2 5 132 13 "Please Enter Log Interval (in seconds) -->" left
enddialog
while TRUE
dlgevent 0 Event
switch Event
case 4
login(sIPAddress)
;call additional procedures here
endcase
case -1
case 5
exitwhile
endcase
endswitch
endwhile
dlgdestroy 0 CANCEL
endproc
;***************************************************************************
proc login
param string sIPAddress
string sIPaddr
waitforit:
strfmt sIPAddr "%s^M^M" sIPAddress
transmit sIPAddr
dialnumber TELNET sIPAddress
pause 1
transmit "^M"
Waitfor "Enter Level: "
transmit "2^M"
transmit "^M" ;brings you to main menu
transmit "5" ;brings you to alarms menu
transmit "1" ;outstanding alarms
transmit "5" ;all_alarms
more1:
If waitfor "Bottom of display has been reached." 2
pause 1
transmit "7" ;more...
transmit "3" ;sub-set
transmit "1" ;all
Else
transmit "2" ;page_down
goto more1
EndIf
more2:
If waitfor "Bottom of display has been reached." 2
pause 1
transmit "9" ;quit
transmit "9" ;quit
Disconnect
Call Timefunction
goto waitforit
Else
transmit "2" ;page_down
goto more2
EndIf
Endproc
;***************************************************************************
Proc Timefunction
string ThisTime
integer Event
long TimeNum,NextTimeNum
ThisTime = $Time24
strsltime $DATE ThisTime TimeNum ;converts a date & time string to a long variable
NextTimeNum = TimeNum + 60 ;Waiting for minute
pause 1
Clear
dialogbox 0 112 34 162 80 3 "Wait...."
text 3 25 25 124 22 "Waiting 1 minute before next reading..." left
editbox 4 87 8 34 12 ThisTime
text 5 25 9 58 11 "Last reading was at :" left
pushbutton 6 52 52 56 14 "Stop" CANCEL
enddialog
while TRUE
dlgevent 0 Event
switch Event
case 6
waituntil NextTimeNum
endcase
case 7
exitwhile
endcase
endswitch
endwhile
dlgdestroy 0 CANCEL
endproc
Thank you.