MyFlight
Technical User
- Feb 4, 2002
- 193
Help,
I am running a script file to change Purge mailboxes andn then Change the Passwords. The Script works fine, however I would like it to open the Completed file upon script termination.
The File I wnat to open in thais case is
"C:\Temp Completed Reports\Completed Sterling Forest.txt"
Here is the Current Script I have:
#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 " PURGED "
#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
string InInfo = ""
string LineBreak = "*************************************"
String OutBuf
;****************************************************************************************/
;* Procedure: Main() Called by: */
;* Last Modified: 03/01/2003 Returns: NONE */
;* Purpose: */
;* */
;****************************************************************************************/
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
strcat sCmdLine fName
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
when Target 11 "PURGE FAILED" call PurgeFail
when Target 12 "The form requested" call PswdInUse
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
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
; Start of PhoneMail Box PURGING Section
waitfor "Function: " 3
transmit "PROFILE^M"
waitfor "Action: "
transmit "PURGE^M"
waitfor "Subscriber Name" 3
transmit sTok1
transmit "^M"
waitfor "Subscriber Name" 3
if FAILURE
transmit ";^M"
fwrite 2 sTok1 6
finsblock 2 14
fwrite 2 sPurgeProblem 14
iPurCount ++
; Start of PhoneMail Box PASSWORD CHANGE Section
transmit "PROFILE^M"
waitfor "Action: "
transmit "MODIFY^M"
else
PAUSE 1
transmit ";^M"
waitfor "Function: " 3
;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 "PROFILE^M"
waitfor "Action: "
transmit "MODIFY^M"
endif
waitfor "Subscriber Name" 3
transmit sTok1
transmit "^M"
waitfor "(last first) : (Previous" 3
if FAILURE
finsblock 2 17
fputs 2 sPswdProblem
iPswdCount ++
transmit ";^M"
else
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" 2
transmit ";^M"
endif
endwhile
strfmt s0 "% d" cPurCount ; formats as " 16"
strfmt s1 "% d" iPurCount ; formats as " 16"
strfmt s2 "% d" cPswdCount ; formats as " 16"
strfmt s3 "% d" iPswdCount ; formats as " 16"
fputs 2 LineBreak
fputs 2 "PhoneMail Box Attributes"
fputs 2 LineBreak
strcpy OutBuf "Boxes Accept Messages: "
strcat OutBuf szAcptMsgs
fputs 2 OutBuf
strcpy OutBuf "Boxes Answer Phone: "
strcat OutBuf szAnswrPhone
fputs 2 OutBuf
strcpy OutBuf "Boxes Give Message Alert: "
strcat OutBuf szMsgAlert
fputs 2 OutBuf
fputs 2 LineBreak
strcpy OutBuf "Total Boxes Purged: "
strcat OutBuf s0
fputs 2 OutBuf
strcpy OutBuf "Total Boxes Not Purged: "
strcat OutBuf s1
fputs 2 OutBuf
strcpy OutBuf "Total Passwords Changed: "
strcat OutBuf s2
fputs 2 OutBuf
strcpy OutBuf "Total Passwords NOT Changed: "
strcat OutBuf s3
fputs 2 OutBuf
fputs 2 LineBreak
strcpy OutBuf "New PhoneMail Box Password: "
strcat OutBuf szPassword
fputs 2 OutBuf
fputs 2 LineBreak
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
usermsg "Script Completed, Open the Completed Report - `"%s`"!" fName
endif
hangup
endproc
;
proc Exit_MailBox
pause 1
transmit ";^M"
endproc
proc Press_Enter
pause 1
transmit "^M"
endproc
proc PurgeFail
PAUSE 1
;Sends the Text Value (Assigned to Variable sTok1) to the PhoneMail System.
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"
endproc
proc PswdInUse
PAUSE 1
;Sends the Text Value (Assigned to Variable sTok1) to the PhoneMail System.
finsblock 2 14
fputs 2 sPswdProblem
iPswdCount ++
transmit ";^M"
endproc
I am running a script file to change Purge mailboxes andn then Change the Passwords. The Script works fine, however I would like it to open the Completed file upon script termination.
The File I wnat to open in thais case is
"C:\Temp Completed Reports\Completed Sterling Forest.txt"
Here is the Current Script I have:
#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 " PURGED "
#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
string InInfo = ""
string LineBreak = "*************************************"
String OutBuf
;****************************************************************************************/
;* Procedure: Main() Called by: */
;* Last Modified: 03/01/2003 Returns: NONE */
;* Purpose: */
;* */
;****************************************************************************************/
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
strcat sCmdLine fName
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
when Target 11 "PURGE FAILED" call PurgeFail
when Target 12 "The form requested" call PswdInUse
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
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
; Start of PhoneMail Box PURGING Section
waitfor "Function: " 3
transmit "PROFILE^M"
waitfor "Action: "
transmit "PURGE^M"
waitfor "Subscriber Name" 3
transmit sTok1
transmit "^M"
waitfor "Subscriber Name" 3
if FAILURE
transmit ";^M"
fwrite 2 sTok1 6
finsblock 2 14
fwrite 2 sPurgeProblem 14
iPurCount ++
; Start of PhoneMail Box PASSWORD CHANGE Section
transmit "PROFILE^M"
waitfor "Action: "
transmit "MODIFY^M"
else
PAUSE 1
transmit ";^M"
waitfor "Function: " 3
;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 "PROFILE^M"
waitfor "Action: "
transmit "MODIFY^M"
endif
waitfor "Subscriber Name" 3
transmit sTok1
transmit "^M"
waitfor "(last first) : (Previous" 3
if FAILURE
finsblock 2 17
fputs 2 sPswdProblem
iPswdCount ++
transmit ";^M"
else
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" 2
transmit ";^M"
endif
endwhile
strfmt s0 "% d" cPurCount ; formats as " 16"
strfmt s1 "% d" iPurCount ; formats as " 16"
strfmt s2 "% d" cPswdCount ; formats as " 16"
strfmt s3 "% d" iPswdCount ; formats as " 16"
fputs 2 LineBreak
fputs 2 "PhoneMail Box Attributes"
fputs 2 LineBreak
strcpy OutBuf "Boxes Accept Messages: "
strcat OutBuf szAcptMsgs
fputs 2 OutBuf
strcpy OutBuf "Boxes Answer Phone: "
strcat OutBuf szAnswrPhone
fputs 2 OutBuf
strcpy OutBuf "Boxes Give Message Alert: "
strcat OutBuf szMsgAlert
fputs 2 OutBuf
fputs 2 LineBreak
strcpy OutBuf "Total Boxes Purged: "
strcat OutBuf s0
fputs 2 OutBuf
strcpy OutBuf "Total Boxes Not Purged: "
strcat OutBuf s1
fputs 2 OutBuf
strcpy OutBuf "Total Passwords Changed: "
strcat OutBuf s2
fputs 2 OutBuf
strcpy OutBuf "Total Passwords NOT Changed: "
strcat OutBuf s3
fputs 2 OutBuf
fputs 2 LineBreak
strcpy OutBuf "New PhoneMail Box Password: "
strcat OutBuf szPassword
fputs 2 OutBuf
fputs 2 LineBreak
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
usermsg "Script Completed, Open the Completed Report - `"%s`"!" fName
endif
hangup
endproc
;
proc Exit_MailBox
pause 1
transmit ";^M"
endproc
proc Press_Enter
pause 1
transmit "^M"
endproc
proc PurgeFail
PAUSE 1
;Sends the Text Value (Assigned to Variable sTok1) to the PhoneMail System.
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"
endproc
proc PswdInUse
PAUSE 1
;Sends the Text Value (Assigned to Variable sTok1) to the PhoneMail System.
finsblock 2 14
fputs 2 sPswdProblem
iPswdCount ++
transmit ";^M"
endproc