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

Script file to change time in Phonemail 1

Status
Not open for further replies.

barb327

Technical User
Feb 22, 2007
11
US
Good Afternoon,
I am tasked with changing time in all my Phonemail systems on March 11. I have about 100 and would like to put it in a script file that includes the Modem numbers. It will dial and connect in Modem command mode and stops. Below is an example of what I have built:

proc main
Transmit "atdt916655553214"
pause 15
transmit "^M"
transmit "^M"
transmit "^M"
transmit "^M"
waitfor "Log"
transmit "sysadmin^M"
waitfor "Pass"
transmit "rgaines44^M"
waitfor "Function:"
transmit "SETT^M"
waitfor "Enter new time [hh:mm:ss] or press Enter:"
transmit "01:42:00^M"
waitfor "Enter new date [mm/dd/yy] or press Enter:"
transmit "^M"
waitfor "Function:"
transmit "logo^M"
waitfor "Action:"
transmit "logo^M"
hangup
pause 5
Transmit "atdt9162655533798"
pause 15
transmit "^M"
transmit "^M"
transmit "^M"
transmit "^M"
waitfor "Log"
transmit "sysadmin^M"
waitfor "Pass"
transmit "rgaines44^M"
waitfor "Function:"
transmit "SETT^M"
waitfor "Enter new time [hh:mm:ss] or press Enter:"
transmit "01:42:00^M"
waitfor "Enter new date [mm/dd/yy] or press Enter:"
transmit "^M"
waitfor "Function:"
transmit "logo^M"
waitfor "Action:"
transmit "logo^M"
hangup
endproc

Is there a better way to do this, or a setting I am failing to catch? Any help would be greatly appreciated!

Barb
 
At what point is the script appearing to hang? My quick guess would be after dialing and finishing the first system. If so, you need to modify Procomm's INI file so data command mode does not turn itself off when the modem hangs up. Here is some information I copied from my site on how to do this, also see for more information on the file to modify:

In later versions of Procomm Plus, the program communicated to the modem through Windows' TAPI layer instead of directly communicating with the hardware. To talk directly to the modem again, modem command mode was introduced. Modem command mode can be turned on via its menu item (Data | Modem Command Mode) or an ASPECT command (commandmode ON/OFF). However, when the current modem connection is disconnected for whatever reason, modem command mode is turned off. An INI entry, UserCmdModeExit, was added to version 4.8 to workaround this issue. Placing this INI entry under the [Options] section and setting it to 1 will cause modem command mode to remain on after a call has been disconnected.

 
Knob,
Thanks for the quick response. It actually hangs after dialing the first number and connecting. It never runs the rest of the script at all.
 
knob,
I got the script to run by dialing the first number through connection directory, but hangup didn't work.
 
I used the same script as above. I dialed through my directory just out of curiosity that the modem hadn't locked up. Once in, I did a Ctrl Q and hit Enter twice. The next thing is the script logged in and ran. It would not hang up when complete, so the second number was never dialed. I did change the INI file.
 
Did you try disconnect instead of hangup? I don't know what the difference is, but it may be worth a try.
 
kodr,
Disconnect works. I still can't get it to connect through "atdt", so the script stops after the first one.
 
I only use Procomm for Telnet myself, so I'm a little shacky on dialing.

Take a look at one of knob's replies to this post thread448-1166837 It's another approach to what you're trying to do. Also, it would avoid hard-coding the phone numbers into your program.

 
I guess I'm confused where you say the last version of the script you posted is the most current, but that you are now dialing through the Connection Directory. Are you dialing a Connection Directory and then running your existing script, either from the Connection Directory entry or manually after the remote modem answers?

 
I want to get this to run manually. I went through the connection directory just to make sure I didn't lock up the modem. I already have all the scripts written, but I can't get any response from Phonemail in the manual mode with the "atdt" command.
 
what about this approach? which also revealed that one of your numbers had too many numbers in it. PS, I'm in the 916 too ;)


proc main
UpdatePhonemailTime( "9162655533798" )
UpdatePhonemailTime( "916655553214" )
endproc

proc UpdatePhonemailTime
param string sPhoneNumber

string sErrMessage = ""

dialnumber DATA sPhoneNumber ; dial the number
while $DIALING ; Pause while dialing
yield
endwhile

if $CARRIER
transmit "^M"
transmit "^M"
transmit "^M"
transmit "^M"
waitfor "Log"
transmit "sysadmin^M"
waitfor "Pass"
transmit "rgaines44^M"
waitfor "Function:"
transmit "SETT^M"
waitfor "Enter new time [hh:mm:ss] or press Enter:"
transmit "01:42:00^M"
waitfor "Enter new date [mm/dd/yy] or press Enter:"
transmit "^M"
waitfor "Function:"
transmit "logo^M"
waitfor "Action:"
transmit "logo^M"
disconnect
pause 15
else
strfmt sErrMessage "FAILED TO CONNECT TO : %s" sPhoneNumber
termmsg sErrMessage
endif
endproc
 
That works! The only problem is going to be the time itself. It has to be enterred as HH:MM:SS. I'll need to break it down to multiple scripts.
 
Try out this code sample:

Code:
proc main
   integer Month, Day         ; Integers to contain date and
   integer Year, Hour         ; time converted from long
   integer Min, Sec           ; date and time.
   string MonStr              ; String to contain month.
	string sTime, sHour, sMin, sSec
	
   ; Convert long time value into it's counter parts, year,
   ; month, day, hour, min, and sec.
   ltimeints $LTIME Year Month Day Hour Min Sec
   monthstr Month MonStr   ; Get the month in string format.
   ;usermsg "Month is %s and it's day %d." MonStr Day
	numtostr Hour sHour
	numtostr Min sMin
	numtostr Sec sSec
	
	sTime = "time "
	strcat sTime sHour
	strcat sTime ":"
	strcat sTime sMin
	strcat sTime ":"
	strcat sTime sSec
	strcat sTime "^m"
	
	transmit sTime 
	
	


endproc
 
I tried to incorporate that into the other script, and it didn't like the information.
 
totally, replace the line
transmit "01:42:00^M"
with
TransmitTime()

and make a proc out of what kodr wrote, and you're money with only using the one script


proc TransmitTime
integer Month, Day ; Integers to contain date and
integer Year, Hour ; time converted from long
integer Min, Sec ; date and time.
string MonStr ; String to contain month.
string sTime, sHour, sMin, sSec

; Convert long time value into it's counter parts, year,
; month, day, hour, min, and sec.
ltimeints $LTIME Year Month Day Hour Min Sec
monthstr Month MonStr ; Get the month in string format.
;usermsg "Month is %s and it's day %d." MonStr Day
numtostr Hour sHour
numtostr Min sMin
numtostr Sec sSec

sTime = "time "
strcat sTime sHour
strcat sTime ":"
strcat sTime sMin
strcat sTime ":"
strcat sTime sSec
strcat sTime "^m"

transmit sTime
endproc
 
Do I remove the transmit sTime? I'm in area 210.
 
Sorry, that was meant as an example of how to manipulate time into a string.

Change the following lines in the example to this:

Code:
    sTime = sHour
    strcat sTime ":"
    strcat sTime sMin
    strcat sTime ":"
    strcat sTime sSec
    strcat sTime "^m"
    
    transmit sTime

Then make the replacement that Ed recommended:

totally, replace the line
transmit "01:42:00^M"
with
TransmitTime()
 
Good Morning All!

I works like a dream! Thanks so much for all of your help.
 
Can you post you FINAL Script as this would help those of us that have the problems in the future.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top