I finally got it to work, here’s the script that automatically connects to the PBX and adjusts the time.
PROC MAIN
dial data "TIME_Ad" ;connect to tty 0
while $DIALING ;necessary loop to pause script
endwhile
pause 2
transmit "xxxxx" ;this is SEB password
waitfor "Ok, You are now transparent to port 1^M"
transmit "logi admin2^M" ;this is admin2 user name
waitfor "PASS?"
transmit "xxxxx" ;this is where you enter password
call captcha
call dothis
call term
ENDPROC
PROC CAPTCHA
string capfile = "File_"
strcat capfile $DATE ;add the DATE to the filename
strreplace capfile "/" "_" ;remove "/" chars as they are invalid for a filename
strcat capfile "TIME.txt" ;denote it as a txt file
set capture path "C:\" ;Capture Directory/Path
set capture file capfile
set capture overwrite ON
clear
capture on
ENDPROC
PROC DOTHIS
integer iDay, iMonth, iYear, iMin, iHour, iSec, TimeDelta
string DMYHMS
TimeDelta=6 ; Approx delay in script....
set txpace 75
Transmit "****^M"
waitfor ">"
transmit "LD 2^M"
waitfor "."
termwrites "System time before adjusting:`n`r"
pause 2
transmit "TTAD^M"
waitfor "."
; Calculate date and time string.
ltimeints $LTIME iYear iMonth iDay iHour iMin iSec
; Adjust for delay in script.
iSec=iSEc+TimeDelta
if iSec>60 ; Seconds must not be greater that 60.
iSec=iSec-60
iMin=iMin+1
if iMin>60 ; Minutes must not be greater that 60.
iMin=iMin-60
iHour=iHour+1
endif
endif
; Put the parts together.
strfmt DMYHMS "STAD %02d %02d %d %02d %02d %02d^M" iDay iMonth iYear iHour iMin iSec
; and send it to the switch
transmit DMYHMS
waitfor "."
pause 6
termwrites "System time after adjusting:`n`r"
pause 1
transmit "TTAD^M"
waitfor "."
pause 1
termwrites "This is the current DST settings: `n`r"
pause 1
transmit "TDST^M"
waitfor "."
pause 1
transmit "****^M"
waitquiet 5 FOREVER
ENDPROC
PROC TERM
capture off
transmit "****" ;log out of LD's
waitfor ">"
transmit "LOGO^M" ;log out of PABX
waitfor ">"
disconnect
pwexit
ENDPROC