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

PhoneMail scripts 1

Status
Not open for further replies.

icetea

Technical User
Nov 28, 2002
45
US
I've been working on a script in Procomm to change out my DID's but it crashes as it starts. Anyone ever do this? this is for a Siemens ROLM Phonemail system.
 
proc main
transmit "pro^M"
waitfor "Action: "
transmit "mod^M"
waitfor "Subscriber Name or Extension: "
transmit "2147^M"
waitfor "Name (last first) : (Previous = Thomas Harold): "
transmit "^M"
waitfor "Class Number : (Previous = 311): "
transmit "^M"
waitfor "Extension [1] (Previous = 2147): "
transmit "8821^M"
waitfor "Would you like to disable network access for this subscriber?[Y/N] "
transmit "n^M"
waitfor "Extension [2] (Previous = 3147): "
transmit "98221^M"
waitfor "Extension [3] "
transmit "^M"
waitfor "PhoneMail Password : (Previous = ##########): "
transmit ";^M"
waitfor "Subscriber Name or Extension: "
transmit "1887^M"
waitfor "Name (last first) : (Previous = Oswood Teresa): "
transmit "^M"
waitfor "Class Number : (Previous = 311): "
transmit "^M"
waitfor "Extension [1] (Previous = 1887): "
transmit "7777^M"
waitfor "Would you like to disable network access for this subscriber?[Y/N] "
transmit "n^M"
waitfor "Extension [2] (Previous = 2887): "
transmit "8888^M"
waitfor "Extension [3] "
transmit ";^M"
endproc


This is just the first part the problem is when I try to link it to a data base to fill in the areas. How do I link excell spread sheet to this to fill out the (ie "8888^M").
 
If you have version 4.8 of Procomm, take a look at the Samples\ASPECT\DDE directory on your CD. This directory contains two sample script (I believe they are essentially the same though) that shows how to read data from an Excel spreadsheet via DDE. aspect@aspectscripting.com
 
Hello,

What part are you Trying to Link ? Is it the Final Output of the Queries ?? If the Output of the Query is needed to be sent to Excel, that is no problem.. Can you Post a FLAT Liner of what you want Excel to Store ??

Hank
 
icetea:

Are you in a Financial Company in California? Maybe a coincidence, but I think I recognize your dial plan. If so, I have scripts for your system becuase I contracted there as a Rolm sysadmin 5 years ago.
Robert Harris
 
No not in Cal. In Ga. Any scripts for siemens phone mail or switchs are always welcome though. I'm just starting out. I found tons of data for Nortel and the rest of them just nothing for siemens systems.

icetea2@bellsouth.net
 
Ok,
I've gotten this far thanks to knob and hankm3 but it's still got a bug in it and I haven't figured it out just yet. Hoping someone can bail me out. The first one is the script the second ond is the txt file.


1st

proc main
string sLine ;Line read from text file
integer iLen ;Integer to hold length of read string
string sExtOne ;First extension from line read from text file
string sExtTwo ;Second extension

if fopen 0 "test1.txt" READ ;Open text file
while not feof 0 ;While there is data to be read from the text file
fgets 0 sLine ;Get line of data
strlen sLine iLen ;Find length of line
if iLen == 0 ;If zero, then we have read a blank line and are at the end
exitwhile ;Exit while loop
endif
strtok sExtOne sLine "," ;Get data before the comma
strreplace sExtOne "`"" "" ;Delete quotes from the string
sExtTwo = sLine
strreplace sExtTwo "`"" "" ;Delete quotes from remaining data
strreplace sExtTwo "," "" ;Get rid of extra comma
strreplace sExtTwo ";" "" ;Get rid of extra semi-colon too
endwhile
endif
fclose 0
endproc

integer flag=0
string sEnter = "^M"
string Fname = "TESTING1.txt" ; File name to be opened.
integer nJumps
string sLine
string sTok1
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 "Extension 1" Call Press_Enter
When Target 4 "Extension 2" call Press_Enter

; set txpace=100

setjmp 0 nJumps ; This is a Jump Mark Point
fgets 0 sLine ; Get line from file.
strtok sTok1 sLine " " 1 ; Assigns Text in First Field (From Text File) to Variable sTok1.
strreplace sLine " " ""
waitfor "Subscriber Name or Extension: " 10
transmit sTok1 ; Sends the Text Value (Assigned to Variable sTok1) to the PhoneMail System.
transmit "^M"
if 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"
else
; do nothing? let Target handle it?
endif

setjmp 1 nJumps
fclose 0 ; Close file opened for read.
; Logout Procedure ----------
waitfor "Subscriber Name or Extension: "
transmit ";^M"
waitfor "Function: "
transmit "logo^M"
waitfor "Action: "
transmit "logo^M"

errormsg "Couldn't open file `"%s`"." Fname

;pause 1
transmit ";^M"
;pause 1

endproc

2nd

"2871","11871","";"
"2840","11840","";"
"2841","11841","";"
"2842","11842","";"
"5756","16756","";"


Thanks again knob , hankm3.

Hal
 
Hal, it looks like you have at least two scripts in your message, one of which was the sample script that I mailed you to demonstrate how to read data from your file and parse the extension data. Did you try the combined script at the end of that email yet?
aspect@aspectscripting.com
 
knob,

part of your last message that you sent me was missing.

Hal
 
Looks like I forgot to copy it into the email message after all! I've mailed another copy to you (luckily I was still at home), let me know if that doesn't make it to you.
aspect@aspectscripting.com
 
This is the finnished script to modifie the phantom number in phonemai. I couldn't have finnished it without the fantastic help from knob and hankm3 my hat is off to you to for your support.

string FnameRead = "c:\temp\TEST1.txt" ; File name to be opened.

proc main
string sLine ;Line read from text file
integer iLen ;Integer to hold length of read string
string sExtOne ;First extension from line read from text file
string sExtTwo ;Second extension

transmit "pro^M"
waitfor "Action: "
transmit "mod^M"
if fopen 0 "test1.txt" READ ;Open text file
while not feof 0 ;While there is data to be read from the text file
fgets 0 sLine ;Get line of data
strlen sLine iLen ;Find length of line
if iLen == 0 ;If zero, then we have read a blank line and are at the end
exitwhile ;Exit while loop
endif
strtok sExtOne sLine "," ;Get data before the comma
strreplace sExtOne "`"" "" ;Delete quotes from the string
sExtTwo = sLine
strreplace sExtTwo "`"" "" ;Delete quotes from remaining data
strreplace sExtTwo "," "" ;Get rid of extra comma
strreplace sExtTwo ";" "" ;Get rid of extra semi-colon too

waitfor "Subscriber Name or Extension: "
transmit sExtOne
transmit "^M"
waitfor "Name (last first) : "
transmit "^M"
waitfor "Class Number : "
transmit "^M"
waitfor "Extension [1]"
transmit sExtOne
transmit "^M"
waitfor "Would you like to disable network access for this subscriber?[Y/N]"
transmit "n^M"
waitfor "Extension [2]"
transmit sExtTwo
transmit "^M"
waitfor "Extension [3] "
transmit ";^M"
endwhile
endif
fclose 0
endproc


TEST1.txt

"2871","11871","";"
"2840","11840","";"
"2841","11841","";"
"2842","11842","";"
"5756","16756","";"
 
Any I need help when I run this script it gives me the following error

Error 5: Invalid identifier

Here is the scipt

string FnameRead = "c:\temp\TEST1.txt" ; File name to be opened.

proc main
string sLine ;Line read from text file
integer iLen ;Integer to hold length of read
string
string sExtOne ;First extension from line read
from text file
string sExtTwo ;Second extension

transmit "pro^M"
waitfor "Action: "
transmit "mod^M"
if fopen 0 "test1.txt" READ ;Open text file
while not feof 0 ;While there is data to be read
from the text file
fgets 0 sLine ;Get line of data
strlen sLine iLen ;Find length of line
if iLen == 0 ;If zero, then we have read a
blank line and are at the end
exitwhile ;Exit while loop
endif
strtok sExtOne sLine "," ;Get data before the comma
strreplace sExtOne "`"" "" ;Delete quotes from the string
sExtTwo = sLine
strreplace sExtTwo "`"" "" ;Delete quotes from remaining data
strreplace sExtTwo "," "" ;Get rid of extra comma
strreplace sExtTwo ";" "" ;Get rid of extra semi-colon too

waitfor "Subscriber Name or Extension: "
transmit sExtOne
transmit "^M"
waitfor "Name (last first) : "
transmit "^M"
waitfor "Class Number : (Previous = 311): "
transmit "^M"
waitfor "Extension [1]"
transmit sExtOne
transmit "^M"
waitfor "Would you like to disable network access for this
subscriber?[Y/N]"
transmit "n^M"
waitfor "Extension [2]"
transmit sExtTwo
transmit "^M"
waitfor "Extension [3] "
transmit ";^M"
endwhile
endif
fclose 0
endproc



Here is the text file

"2871","11871","
"2840","11840","
"2841","11841","
"2842","11842","
"5756","16756","


 
Can anyone help. This is the error I get when I run the script.

Error 5: Invalid identifier

Here is the scipt

string FnameRead = "c:temp\TEST1.txt" ; File name to be opened.

proc main
string sLine ;Line read from text file
integer iLen ;Integer to hold length of read
string
string sExtOne ;First extension from line read
from text file
string sExtTwo ;Second extension

transmit "pro^M"
waitfor "Action: "
transmit "mod^M"
if fopen 0 "test1.txt" READ ;Open text file
while not feof 0 ;While there is data to be read
from the text file
fgets 0 sLine ;Get line of data
strlen sLine iLen ;Find length of line
if iLen == 0 ;If zero, then we have read a
blank line and are at the end
exitwhile ;Exit while loop
endif
strtok sExtOne sLine "," ;Get data before the comma
strreplace sExtOne "`"" "" ;Delete quotes from the string
sExtTwo = sLine
strreplace sExtTwo "`"" "" ;Delete quotes from remaining data
strreplace sExtTwo "," "" ;Get rid of extra comma
strreplace sExtTwo ";" "" ;Get rid of extra semi-colon too

waitfor "Subscriber Name or Extension: "
transmit sExtOne
transmit "^M"
waitfor "Name (last first) : "
transmit "^M"
waitfor "Class Number : (Previous = 311): "
transmit "^M"
waitfor "Extension [1]"
transmit sExtOne
transmit "^M"
waitfor "Would you like to disable network access for this
subscriber?[Y/N]"
transmit "n^M"
waitfor "Extension [2]"
transmit sExtTwo
transmit "^M"
waitfor "Extension [3] "
transmit ";^M"
endwhile
endif
fclose 0
endproc



Here is the text file

"2871","11871","
"2840","11840","
"2841","11841","
"2842","11842","
"5756","16756","
 
The problem is the string FnameRead = "c:temp\TEST1.txt" .

Your command
if fopen 0 "test1.txt" READ ;Open text file
should read
if fopen 0 FnameRead.
The way it is set up, it would look for the file "test1.txt" in the default Aspect directory.
Robert Harris
 
Again I'd like to thank knob, hankm3, and Rharris for your great help in getting this script running. I ran it on site one tonight and it worked perfectly. I have 9 more sites to run over the rest of this mo. Tonight alone it has saved me 15 hours of manual programming. Thanks to you folks I have freed up the time to do other projects and allowing me to learn more about Aspect. Thanks again!


Icetea
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top