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

Get Time info

Status
Not open for further replies.

mlevine

MIS
Jul 21, 2002
91
US
Hello, I am trying to write a script that will take the current PC time on my machine and upload it into a phone switch (via a telnet like connection)in a certain way.

The format needs to look like this

STAD DAY MONTH YEAR HOUR MINUTE SECOND
^-switch cmd.

The day = things like WED,FRI etc and Year needs to be 4 digits.

Any thoughts would be apprciated.
 
Here is a script to get your started with (sCmdLine will contain the required string). I'm not sure it will work 100% in your environment since the output of the weekdaystr is the full name of the day, but you could replace the weekdaystr command with a switch/case structure that assigns a value to the variable sDay based on the value of iDayWeek.

proc main
integer iDay, iMonth, iYear, iHour, iMin, iSec
integer iDayWeek, iDayYear, iLeapYear
string sCmdLine, sDay

ltimeints $LTIME iYear iMonth iDay iHour iMin iSec
ltimemisc $LTIME iDayWeek iDayYear iLeapYear
weekdaystr iDayWeek sDay

strfmt sCmdLine "STAD %s %d %d %d %d %d" sDay iMonth iYear iHour iMin iSec
endproc

aspect@aspectscripting.com
 
Excellant, this worked like a charm... Many thanks!!

Matt
 
Here is a script Knob helped me with about 2 years ago and it works terrific on Meridian 1 PBX! I have never had a problem with it.

*******************************

;This script will take the time from your windows PC and tranmit it to the M1

;You must Be Logged in to to switch already for this to work

proc main
integer iDay, iMonth, iYear, iMin, iHour, iSec
string sSend

ltimeints $LTIME iYear iMonth iDay iHour iMin iSec

strfmt sSend "STAD %02d %02d %d %02d %02d %02d" iDay iMonth iYear iHour iMin iSec
set txpace 15
transmit "****^M"
waitfor ">"
transmit "ld 2^M"
waitfor "."
transmit "TTAD^M"
waitfor "."
transmit sSend
transmit "^M"
waitfor "."
pause 2
transmit "TTAD^M"
waitfor "."
pause 2
transmit "****^M"


Endproc

***********************


Ron
 
This script will login into the Nortel PBX. Set the time to your PC time and date and logout
You only need to change three things "define Name" ,"define Pswd" and "Waituntil" (Waituntil if you want to run it at a certain time and date.

;Procomm Script to SET TIME LD 2)
;===============================================================
;
#define Name "Logi^M" ;if you use Name login change to "LOGI YOUR_Name_Here^M"
#define Pswd "12345^M" ; Put your password here

;Waituntil "9:26:00" "1/27/05"

proc main
integer iDay, iMonth, iYear, iMin, iHour, iSec
string sSend
ltimeints $LTIME iYear iMonth iDay iHour iMin iSec
strfmt sSend "STAD %02d %02d %d %02d %02d %02d" iDay iMonth iYear iHour iMin iSec

set txpace 75
Transmit "****^M"
pause 1
Transmit "LOGO^M"
pause 1
Transmit Name
Transmit Pswd
waitfor ">"
transmit "ld 2^M"
waitfor "."
transmit "TTAD^M"
waitfor "."
transmit sSend
transmit "^M"
waitfor "."
pause 2
transmit "TTAD^M"
waitfor "."
pause 2
transmit "****"
transmit "LOGO^M"
endproc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top