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

how to speed up a script

Status
Not open for further replies.

badtech

Technical User
Dec 11, 2005
20
0
0
US
I wrote a script to add mailboxes. It works fine but it waits 30 seconds before it starts to add the next one. How can I cut down the time to 5 seconds.
thanx
 
If it's pausing 30 seconds, one possible problem is that you have a waitfor command that is timing out due to the string not being received (the timeout by default is 30 seconds).

 
sorry about that. Be easy this is the first one I tried to write

thanx

proc main

string sline, name,ext1
fopen 0 "try1.txt" read ;open data file
while not feof 0;while the file still has data
fgets 0 sline ;read the line of data
strtok name sline "`t" 1 ; get line of first field
strtok ext1 sline "`t" 1 ; get line of second field


set txpace 50

waitfor "Name (last first) : "
transmit name
waitfor "Class Number : "
transmit "10^M"
waitfor "Extension [1] "
transmit ext1
waitfor "Extension [2] "
transmit "^M"
waitfor "PhoneMail Password : (Default = ##########): "
transmit "^M"
waitfor "Group Name : (Default = ): "
transmit ";^M"

endwhile

fclose 0

endproc
 
Yep, I would definitely check those waitfors. Just watch your script execute and see if the contents of the transmit strings are sent immediately after the text from the preceding waitfor commands appears. If not, then you likely need to trim and/or double-check the strings in the waitfor commands.

 
It's generaly not necessary (and not recommended) to
match a line so explicitly as you do.
A line like:
Code:
waitfor "Group Name          : (Default = ):  "
could probably been replaced with something like:
Code:
waitfor "= ):  "
That is, only the end of the line.

By redusing the matching text you increase the likelyhood of making a match.
As longe as yout matching text is unique to what you expect, then your good to go.

HTH :)
 
Your application is missing the string "Name (last first) : " while reading the values in during the loop. You need to put your statment waitfor "Name (last first) : " at the the end and then loop back to the top to read your new data. The following change should work. I also corrected your nesting to reflect the DoWhile loop.



proc main

string sline, name,ext1
fopen 0 "try1.txt" read ;open data file

while not feof 0;while the file still has data
fgets 0 sline ;read the line of data
strtok name sline "`t" 1 ; get line of first field
strtok ext1 sline "`t" 1 ; get line of second field
set txpace 50
transmit name
waitfor "Class Number : "
transmit "10^M"
waitfor "Extension [1] "
transmit ext1
waitfor "Extension [2] "
transmit "^M"
waitfor "PhoneMail Password : (Default = ##########): "
transmit "^M"
waitfor "Group Name : (Default = ): "
transmit ";^M"
waitfor "Name (last first) : "


endwhile

fclose 0

endproc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top