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

Script that automatically starts at any time you want and Adjust time 1

Status
Not open for further replies.

StoneColdphoneman

Technical User
Jan 13, 2003
360
US
Adjust time
If you are looking for script that automatically starts at any time you want and executes any script here it is.
This script will connect and adjust time in your PBX.

First you need to create .bat file, here’s the example.

cd \
cd \PROGRA~1\Symantec\PROCOM~1\PROGRAMS\
PW5.EXE <script name>.wax

exit *closes the cmd window when done.

Just type that into a notepad file and then save as a .bat file.

Second you need to add to your scheduled task .bat file under run and you are all set.



Code:
[aqua]<html>[/aqua]
  [aqua]<head>[/aqua]
    [teal]<title>[/teal]Page[teal]</title>[/teal]
  [aqua]</head>[/aqua]
  [navy]<body>[/navy]
   
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 PBX
    waitfor ">"
    disconnect
    pwexit
ENDPROC
 


  [navy]</body>[/navy]
[aqua]</html>[/aqua]



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top