MyFlight
Technical User
- Feb 4, 2002
- 193
OK,
Lets see if I can simplify what I want to do. I tend to get carried away in my explanations, and I apologize in advance.
NOTE: Most of the Script for sending this information from the TEXT File to the Comm Port is already working.
Mostly thanks to KNOB and HANK3.
1. Basically I am Connecting to a ROLM PhoneMail system (logging in and moving to the “Function:” Prompt).
2. Second I need to Purge the 1st Extension From the TestFile.text in PhoneMail.
a. If Successful write the sDone Variable (“COMPLETED”) to the 1st Line next to the Extension.
b. IF NOT Successful write the sProblem Variable (“INCOMPLETE”) to the 1st Line next to the Extension
3. Next I need to Modify the PhoneMail Box itself (i.e. Change the Password etc).
a. If Successful write the sDone Variable (“COMPLETED”) to the 1st Line next to the Extension.
b. IF NOT Successful write the sProblem Variable (“INCOMPLETE”) to the 1st Line next to the Extension
4. Upon Completion of the Script File I want to Save the Updated TestFile.txt File.
a. If Carrier is lost Save the File.
b. If Script completes successfully Save the File.
5. I have a Text File (will call it TestFile.txt), that contains a list of Values (Extensions).
a. I do not know if the Extension Length will remain Constant.
b. The Number of Extensions in the TestFile.txt will vary.
6. I would like to Transmit the 1st value in the TestFile.txt. (ALREADY Working)
a. If NO Error Message is received, insert the Word "COMPLETED", Next for the 1st Value.
b. If an ERROR message is received I want to insert the Word "INCOMPLETE", Next for the 1st Value.
7. If Dial Tone is LOST I would Like to Save the File so that I can Pick Up where the Script Left off. Please Note, this does not necessarily need to be automated (but it would be nice).
8. Assumption Number One: The Extensions are 4 Digits in length (For Arguments Sake, this may vary).
9. When I try to Update the File it either overwrites the Whole File, or writes all the information in one continuous line.
10. Here is an example of what I want to do.
EXAMPLE:
1234
1235
1236
1237
1238
UPDATED TEXT FILE:
1234 COMPLETED INCOMPLETE
1235 INCOMPLETE COMPLETED
1236 COMPLETED COMPLETED
1237 INCOMPLETE
1238
11. What I need to figure out is the portion of the Script file to write items 2a and 2b to the TextFile.txt.
a. I am Using the Following Variables in my Script File:
1. sLine ;Line of text Read from TestFIle.txt
2. sTok1 ;Variable
3. sDone = “COMPLETED” ; Used when Extension (From TestFile.txt) Is either Purged or Modified Successfully
4. sProblem = “INCOMPLETE” ; Used when Extension (From TestFile.txt) Is either NOT Purged or Modified.
5. fgets 1 sLine ;Retrieves the 1 Record in the TestFile.txt File
proc main
string szNewPswd,szSiteName,sTok1,sLine
string sEnter = "^M"
string sDone = "COMPLETE"
string sProblem = "INCOMPLETE"
sdlginput "Site Name" "Enter Site Name:" szSiteName ; Assigns Site Name to the Variable szSiteName
pause 1
sdlginput "New Password" "Enter the New DEFAULT Password:" szNewPswd ; Assigns Password to szNewPswd
pause 1
strcat szNewPswd sEnter
if isfile "C:\Temp Data Files\Raw Data\TestFile.txt" ; Verifies that File does Exist.
fopen 1 "C:\Temp Data Files\Raw Data\TestFile.txt" READ TEXT ; Opens Text File
while not feof 1
fgets 1 sLine
strtok sTok1 sLine "," 1 ; Assigns Text in First Field (From Text File) to Variable sTok1.
strreplace sLine " " " "
waitfor "Function: " FOREVER
transmit "PROFILE^M"
waitfor "Action: "
transmit "PURGE^M"
waitfor "Subscriber Name or Extension: "
transmit sTok1 ; Sends the Text Value (Assigned to Variable sTok1) to the PhoneMail System.
transmit "^M"
if waitfor "Function: " 10
transmit "PROFILE^M"
waitfor "Action: "
transmit "MODIFY^M"
waitfor "Subscriber Name or Extension: "
transmit sTok1 ; Sends the Text Value (Assigned to Variable sTok1) to the PhoneMail System.
transmit "^M"
if waitfor "PhoneMail Password : (Previous = ##########): " 10
transmit szNewPswd
;INSERT WRITE sDone TO TEXT FILE SCRIPT HERE
else
transmit ";^M"
;INSERT WRITE sProblem TO TEXT FILE SCRIPT HERE
endif
else
transmit ";^M"
waitfor "Function: "
transmit "PROFILE^M"
waitfor "Action: "
transmit "MODIFY^M"
waitfor "Subscriber Name or Extension: "
transmit sTok1 ; Sends the Text Value (Assigned to Variable sTok1) to the PhoneMail System.
transmit "^M"
if waitfor "PhoneMail Password : (Previous = ##########): " 10
transmit szNewPswd
;INSERT WRITE sDone TO TEXT FILE SCRIPT HERE
else
transmit ";^M"
;INSERT WRITE sProblem TO TEXT FILE SCRIPT HERE
endif
endif
endwhile
endif
fclose 1
fclose 2
transmit ";^M"
waitfor "Function: " forever
transmit "LOG^M"
waitfor "Action: " forever
transmit "LOG^M"
capture OFF
hangup
endproc
I HOPE I HAVE EXPLAINED THIS PROPERLY
Lets see if I can simplify what I want to do. I tend to get carried away in my explanations, and I apologize in advance.
NOTE: Most of the Script for sending this information from the TEXT File to the Comm Port is already working.
Mostly thanks to KNOB and HANK3.
1. Basically I am Connecting to a ROLM PhoneMail system (logging in and moving to the “Function:” Prompt).
2. Second I need to Purge the 1st Extension From the TestFile.text in PhoneMail.
a. If Successful write the sDone Variable (“COMPLETED”) to the 1st Line next to the Extension.
b. IF NOT Successful write the sProblem Variable (“INCOMPLETE”) to the 1st Line next to the Extension
3. Next I need to Modify the PhoneMail Box itself (i.e. Change the Password etc).
a. If Successful write the sDone Variable (“COMPLETED”) to the 1st Line next to the Extension.
b. IF NOT Successful write the sProblem Variable (“INCOMPLETE”) to the 1st Line next to the Extension
4. Upon Completion of the Script File I want to Save the Updated TestFile.txt File.
a. If Carrier is lost Save the File.
b. If Script completes successfully Save the File.
5. I have a Text File (will call it TestFile.txt), that contains a list of Values (Extensions).
a. I do not know if the Extension Length will remain Constant.
b. The Number of Extensions in the TestFile.txt will vary.
6. I would like to Transmit the 1st value in the TestFile.txt. (ALREADY Working)
a. If NO Error Message is received, insert the Word "COMPLETED", Next for the 1st Value.
b. If an ERROR message is received I want to insert the Word "INCOMPLETE", Next for the 1st Value.
7. If Dial Tone is LOST I would Like to Save the File so that I can Pick Up where the Script Left off. Please Note, this does not necessarily need to be automated (but it would be nice).
8. Assumption Number One: The Extensions are 4 Digits in length (For Arguments Sake, this may vary).
9. When I try to Update the File it either overwrites the Whole File, or writes all the information in one continuous line.
10. Here is an example of what I want to do.
EXAMPLE:
1234
1235
1236
1237
1238
UPDATED TEXT FILE:
1234 COMPLETED INCOMPLETE
1235 INCOMPLETE COMPLETED
1236 COMPLETED COMPLETED
1237 INCOMPLETE
1238
11. What I need to figure out is the portion of the Script file to write items 2a and 2b to the TextFile.txt.
a. I am Using the Following Variables in my Script File:
1. sLine ;Line of text Read from TestFIle.txt
2. sTok1 ;Variable
3. sDone = “COMPLETED” ; Used when Extension (From TestFile.txt) Is either Purged or Modified Successfully
4. sProblem = “INCOMPLETE” ; Used when Extension (From TestFile.txt) Is either NOT Purged or Modified.
5. fgets 1 sLine ;Retrieves the 1 Record in the TestFile.txt File
proc main
string szNewPswd,szSiteName,sTok1,sLine
string sEnter = "^M"
string sDone = "COMPLETE"
string sProblem = "INCOMPLETE"
sdlginput "Site Name" "Enter Site Name:" szSiteName ; Assigns Site Name to the Variable szSiteName
pause 1
sdlginput "New Password" "Enter the New DEFAULT Password:" szNewPswd ; Assigns Password to szNewPswd
pause 1
strcat szNewPswd sEnter
if isfile "C:\Temp Data Files\Raw Data\TestFile.txt" ; Verifies that File does Exist.
fopen 1 "C:\Temp Data Files\Raw Data\TestFile.txt" READ TEXT ; Opens Text File
while not feof 1
fgets 1 sLine
strtok sTok1 sLine "," 1 ; Assigns Text in First Field (From Text File) to Variable sTok1.
strreplace sLine " " " "
waitfor "Function: " FOREVER
transmit "PROFILE^M"
waitfor "Action: "
transmit "PURGE^M"
waitfor "Subscriber Name or Extension: "
transmit sTok1 ; Sends the Text Value (Assigned to Variable sTok1) to the PhoneMail System.
transmit "^M"
if waitfor "Function: " 10
transmit "PROFILE^M"
waitfor "Action: "
transmit "MODIFY^M"
waitfor "Subscriber Name or Extension: "
transmit sTok1 ; Sends the Text Value (Assigned to Variable sTok1) to the PhoneMail System.
transmit "^M"
if waitfor "PhoneMail Password : (Previous = ##########): " 10
transmit szNewPswd
;INSERT WRITE sDone TO TEXT FILE SCRIPT HERE
else
transmit ";^M"
;INSERT WRITE sProblem TO TEXT FILE SCRIPT HERE
endif
else
transmit ";^M"
waitfor "Function: "
transmit "PROFILE^M"
waitfor "Action: "
transmit "MODIFY^M"
waitfor "Subscriber Name or Extension: "
transmit sTok1 ; Sends the Text Value (Assigned to Variable sTok1) to the PhoneMail System.
transmit "^M"
if waitfor "PhoneMail Password : (Previous = ##########): " 10
transmit szNewPswd
;INSERT WRITE sDone TO TEXT FILE SCRIPT HERE
else
transmit ";^M"
;INSERT WRITE sProblem TO TEXT FILE SCRIPT HERE
endif
endif
endwhile
endif
fclose 1
fclose 2
transmit ";^M"
waitfor "Function: " forever
transmit "LOG^M"
waitfor "Action: " forever
transmit "LOG^M"
capture OFF
hangup
endproc
I HOPE I HAVE EXPLAINED THIS PROPERLY