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!

Getting a character in text file 1

Status
Not open for further replies.

Muntanha

MIS
May 24, 2002
9
BR
Hi friends...

See my doubts:

proc main
transmit "chg^M"
waitfor "TYPE"
transmit "500^M"
waitfor "TN "
transmit "4 0 9 3^M"
waitfor "ECHG "
transmit "yes^M"
waitfor "ITEM "
transmit "cls fna^M"
waitfor "ITEM"
transmit "^M"
waitfor "REQ: "

#Doubt 1: After the expression 'waitfor "REQ: "', I need of a loop to 'transmit "chg^M"';

#Doubt 2: In the line 'transmit "4 0 9 3^M"', I need that the characters '4 0 9 3' be extracted of a txt file or a excel file. ie, the next character sequence would be '4 0 9 4', '4 0 9 5' (...)

I'm waiting the help, thanks...

PS: Sorry for my bad english ok?
 
On the first item, are you saying you want to loop from the waitfor "REQ: " back to the first statement in proc main (transmit "chg^M")? Should it continue looping until the text in the file mentioned in your second question has all been read?

I think reading the data from the text file will be a little easier than the Excel file (DDE is needed to read from Excel; it's much easier to read a standard text file). I have a couple sample scripts on my site here, just search a couple times for text file:


Basically, it would look something like this:

if fopen filename READ TEXT
while not feof 0
fgets 0 sLine
transmit sLine
transmit "^M"
endwhile
endif

 
The example that you gave using:

transmit "chg^M"
waitfor "TYPE"
transmit "500^M"
waitfor "TN "
transmit "4 0 9 3^M"
waitfor "ECHG "
transmit "yes^M"
waitfor "ITEM "
transmit "cls fna^M"
waitfor "ITEM"
transmit "^M"
waitfor "REQ: "

I would use "mail merge" utility in word and you could very easily import a TN list from an excel listing and change anywhere from 20 to 300 phones quickly. Once you get down the steps to mail merge from an excel sheet it just becomes so easy to write large changes.

It is one of my absolute favorite tricks I use it all the time for Meridian programming changes!!

Check out this link it explains it in detail how to do what I quickly described:


Hope this helps,

Ron
 
Hi knob, I thank that my second doubt is fixed. But if you can help me in the first doubt (as you talked, it must continue looping until the text in the file mentioned in my second question has all been read). Best regards!!!
 
Give this a tryL

proc main
string filename, sLine

if fopen 0 filename READ TEXT
while not feof 0
fgets 0 sLine
transmit sLine
transmit "^M"
endwhile
transmit "chg^M"
waitfor "TYPE"
transmit "500^M"
waitfor "TN "
transmit sLine
transmit "^M"
waitfor "ECHG "
transmit "yes^M"
waitfor "ITEM "
transmit "cls fna^M"
waitfor "ITEM"
transmit "^M"
endif
endproc

 
Hi Knob, sorry for the long time to response. Please, see my script:

proc main
string filename, sLine

transmit "chg^M"
waitfor "TYPE:"
transmit "3902^M"
waitfor "TN "
transmit sLine


if fopen 0 "tn.txt" READ TEXT
while not feof 0
fgets 0 sLine
transmit sLine
transmit "^M"
endwhile


waitfor "ECHG "
transmit "yes^M"
waitfor "ITEM "
transmit "cls fna^M"
waitfor "ITEM"
transmit "^M"

endif
endproc

It´s working, but It don't go to the next line of the file "tn.txt". See the file content:

2 4
2 5
2 6
2 7
2 8
(...)

The script is working but It make only to first line. The others lines don't working.

Thanks and regards!!!

 
Getting ready to leave the office, but what happens if you move the lines:

waitfor "ECHG "
transmit "yes^M"
waitfor "ITEM "
transmit "cls fna^M"
waitfor "ITEM"
transmit "^M"

inside the while/endwhile loop?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top