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!

Finding Text on the Screen with Modem Connection

Status
Not open for further replies.

MyFlight

Technical User
Feb 4, 2002
193
Help,
I have a ProComm Script for a phonemail system that performs the Following:

1. Reads extensions from a file.
2. Purges the phonemail boxes.
3. Modifies the PhoneMail box Password.

However, I need to put in some ERROR checking for the following:

1. If the Purge FAILS - PhoneMail writes “Purge Failed” to the screen and provides the Subscriber Name Prompt again).

2. If the PhoneMail box CANNOT BE FOUND - - PhoneMail writes “Cannot find this form.” to the screen and moves to the “Function:” prompt.

3. if the Purge is SUCESSFUL - PhoneMail writes “Mailbox purged” to the screen and provides the Subscriber Name Prompt again).

At the end of the Script I need to track the Following items:

1. TOTAL Number of Mailboxes.
2. Number of Mailboxes Purged.
3. Number of Mailboxes NOT Purged.
4. Number of Mailboxes that had the Passwords changed.
5. Number of Mailboxes that do NOT have new Passwords.

Any and all help will be greatly appreciated.



Sample Screen Print:
if Extenison is Found and Purged


Function: PROFILE
Wed Feb 26, 2003 9:53 AM

Action: PURGE

Subscriber Name or Extension: 6704

Mailbox purged
Subscriber Name or Extension: ;

Sample Screen Print:
if Extension is Found and NOT Purged



Function: PROFILE
Wed Feb 26, 2003 12:12 PM

Action: PURGE

Subscriber Name or Extension: 6709

Purge failed
Subscriber Name or Extension:


Sample Screen Print:
if Extension is NOT Found and



Function: PROFILE
Wed Feb 26, 2003 12:12 PM

Action: PURGE

Subscriber Name or Extension: 6715

Cannot find this form.

Function:

Current Script File:

#define WorkDir "C:\Temp Data Files\Raw Data\"
#define SaveDir "C:\Temp Completed Reports\"
#define OldFname "BCRS_STF.txt"
#define szSiteName "Sterling Forest"
#define sEnter "^M"
#define sPurgeDone " PURGE DONE "
#define sPurgeProblem " NOT-PURGED "
#define sPswdDone " NEW PASSWORD"
#define sPswdProblem " PSWD NOT CHANGED"
#define szSpace " "
#define fEnd ".txt"
#define sComputerSetUp "\\rmss0020\FTPStuff\RH_Pro.exe"
integer iLen, ivar, cPurCount, cPswdCount, iPurCount, iPswdCount

string fName = "Completed "
string SzPmOptions, szAcptMsgs, szAnswrPhone, szMsgAlert
string szNewPswd, szPassword, sTok1, sLine
string SourceF = "c:\Program Files\Symantec\ProComm Plus\Upload\BCRS_STF.txt" ; File to copy.
string DestF = "c:\Temp Data Files\Raw Data\BCRS_STF.txt" ; Destination
string SourceG = "C:\Temp Completed Reports\Completed Sterling Forest.txt" ; Destination

Proc main

if $CONNECTOPEN
; check for connection...

sdlginput "New Password" "Enter the New DEFAULT Password:" szNewPswd
sdlginput "Accept Messages" "Should the Box Accept Messages (T/F)??:" szAcptMsgs
sdlginput "Answer Phone" "Should the Box Answer the Phone (T/F)??:" szAnswrPhone
sdlginput "Message Alert" "Should the Box Provide a Message Alert (T/F)??:" szMsgAlert

strcat SzPmOptions szAcptMsgs
strcat SzPmOptions szSpace
strcat SzPmOptions szAnswrPhone
strcat SzPmOptions szSpace
strcat SzPmOptions szMsgAlert
strcat SzPmOptions sEnter
strcpy szPassword szNewPswd
strcat szNewPswd sEnter
strcat fName szSiteName
strcat fName fEnd

when Target 0 "Extension : " call Press_Enter
when Target 1 "Name (last first) : " call Press_Enter
when Target 2 "Class Number : " call Press_Enter
when Target 3 "Group Name : " call Press_Enter
when Target 4 "Referral Extension : " call Press_Enter
when Target 5 "Volume Level : " call Press_Enter
when Target 6 "Speed level : " call Press_Enter
when Target 7 "Abbreviated Prompts?: " call Press_Enter
when Target 8 "Alt Greeting Active?: (Previous =" call Press_Enter
when Target 9 "Software Mailbox ? : (Previous =" call Press_Enter
when Target 10 "Extension [" call Press_Enter

if not copyfile SourceF DestF ; Backup script files.
errormsg "Couldn't copy file `"%s`"!" SourceF
exit
endif
if not delfile SourceF ; Delete the temporary file.
errormsg "Couldn't delete `"%s`"!" SourceF
exit
endif
if not delfile SourceG ; Delete the temporary file.
errormsg "Couldn't delete `"%s`"!" SourceG
exit
endif
PAUSE 3
chdir WorkDir
isfile OldFname ivar ; Verifies that File does Exist.
if SUCCESS
; Opens Text File
fopen 1 OldFname READWRITE TEXT
; Creates a New Text File With the Name: Completed + the SiteName User Provides
chdir SaveDir
fopen 2 fName CREATE TEXT
pause 2
; Logs you into the PhoneMail System and gets you to the Function Prompt.
transmit "^M"
Execute "Log-SA.wax"
cPurCount = 0
iPurCount = 0
cPswdCount = 0
iPswdCount = 0
while not feof 1
fgets 1 sLine
strlen sLine iLen
; Assigns Text in First Field (From Text File) to Variable sTok1.
strtok sTok1 sLine " " 1
waitfor "Function: " FOREVER
transmit "PROFILE^M"
waitfor "Action: "
transmit "PURGE^M"
waitfor "Subscriber Name"
transmit sTok1
transmit "^M"
waitfor Subscriber Name
if FAILURE
PAUSE 1
; Sends the Text Value (Assigned to Variable sTok1) to the PhoneMail System.
fwrite 2 sTok1 6
finsblock 2 14
fwrite 2 sPurgeDone 14
cPurCount ++
transmit ";^M"
waitfor "Function:" 2
transmit "PROFILE^M"
waitfor "Action: "
transmit "MODIFY^M"
waitfor "Subscriber Name"
; Sends the Text Value (Assigned to Variable sTok1) to the PhoneMail System.
transmit sTok1
transmit "^M"
waitfor "Cannot find " 1
if FAILURE
waitfor "PhoneMail Password"
transmit szNewPswd
finsblock 2 17
fputs 2 sPswdDone
waitfor " Enter T or F for each field): "
transmit SzPmOptions
cPswdCount ++
waitfor "Failed Acc Attempt : (Previous ="
transmit "0;^M"
waitfor "Subscriber Name"
transmit ";^M"
else
transmit ";^M"
finsblock 2 17
fputs 2 sPswdProblem
iPswdCount ++
transmit ";^M"
transmit ";^M"
endif
else
fwrite 2 sTok1 6
finsblock 2 14
fwrite 2 sPurgeProblem 14
iPurCount ++
transmit ";^M"
waitfor "Function:" 2
transmit "PROFILE^M"
waitfor "Action: "
transmit "MODIFY^M"
waitfor "Subscriber Name"
; Sends the Text Value (Assigned to Variable sTok1) to the PhoneMail System.
transmit sTok1
transmit "^M"
waitfor "Cannot find " 1
if FAILURE
waitfor "PhoneMail Password"
transmit szNewPswd
finsblock 2 17
fputs 2 sPswdDone
waitfor " Enter T or F for each field): "
transmit SzPmOptions
cPswdCount ++
waitfor "Failed Acc Attempt : (Previous ="
transmit "0;^M"
transmit ";^M"
else
transmit ";^M"
finsblock 2 17
fputs 2 sPswdProblem
iPswdCount ++
transmit ";^M"
transmit ";^M"
endif
endif
endwhile
fclose 1
fclose 2
else
usermsg "Missing BCRS_STF.txt FILE"
exit
endif
else
usermsg "Lost Connection Please Try Again"
exit
endif
pause 1
transmit ";^M"
waitfor "Function: " forever
transmit "LOG^M"
waitfor "Action: " forever
transmit "LOG^M"
capture OFF
chdir WorkDir
PAUSE 3
if not delfile OldFname ; Delete the temporary file.
errormsg "Couldn't delete `"%s`"!" OldFname
else
usermsg "`"%s`" deleted." OldFname
endif
hangup
usermsg "New PhoneMail Box Password: `"%s`"!" szPassword
usermsg "Boxes Accept Messages: `"%s`"!" szAcptMsgs
usermsg "Boxes Message Alert: `"%s`"!" szMsgAlert
usermsg "Boxes Answer Phone: `"%s`"!" szAnswrPhone
; usermsg "Purged MailBoxes: `"%s`"!" OldFname
usermsg "Boxes Purged: '%d'" cPurCount
usermsg "Boxes NOT Purged: '%d'" iPurCount
usermsg "Passwords Changed: '%d'" cPswdCount
usermsg "Passwords NOT Changed: '%d'" iPswdCount
endproc
;
proc Exit_MailBox
pause 1
transmit ";^M"
endproc
proc Press_Enter
pause 1
transmit "^M"
endproc
 
I think the easiest way to do this would be to use additional when target commands to key off the status messages that are returned. You would need to define three global integers for those called procedures to access (the procedure would increment the appropriate value by one) so the script can track how many times each procedure was called, thereby giving you the number of mailboxes that could not be purged, could not be found, or were purged successfully.

Am I correct in saying that you are attempting to change the passwords and purge all mailboxes? You can create an integer variable that you increment by one each time you read an extension from the text file. This will then give you the total number of mailboxes that the script accessed. aspect@aspectscripting.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top