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

Pulling variables from a text file 1

Status
Not open for further replies.

jeditom

IS-IT--Management
Dec 3, 2003
23
0
0
US
How do I redirect my script in a loop to grab the two variables below being transmitted (in this case a 1) from an alternate file?

; CHOOSE 1 TO CHANGE THE SHELF
waitfor "SHELF=" Forever
waitfor "ENTER SELECTION : [24;32H"
transmit "1"
waitquiet 1
transmit "^M"

; ENTER THE SHELF NUMBER
waitfor "ENTER SHELF : [[24;28H"
transmit "1"
waitquiet 1
transmit "^M"
 
Here's an example that opens a text file, then reads line by line through the file, transmitting the line read from the string (assumed to be one in your case) twice as you had it in your original script.


aspect@aspectscripting.com
 
Knob,

Where is the example?

THANKS!
 
Strange, guess I didn't paste it. Here it is:

proc main
string sLine ;Contains line read from text file
integer iLen ;Length of string read from text file

if fopen 0 "data.txt" READ TEXT ;If data file is opened successfully...
while not feof 0 ;While data remains in file...
fgets 0 sLine ;Read line from file
strlen sLine iLen ;Get length of line
if iLen != 0 ;If line is not blank
fgets 0 sLine ;Read line from file
; CHOOSE 1 TO CHANGE THE SHELF
waitfor "SHELF=" Forever
waitfor "ENTER SELECTION : [24;32H"
transmit sLine
waitquiet 1
transmit "^M"

; ENTER THE SHELF NUMBER
waitfor "ENTER SHELF : [[24;28H"
transmit sLine
waitquiet 1
transmit "^M"
endif
endwhile
else
errormsg "Data file not found!" ;Display error message.
exit
endif
endproc

aspect@aspectscripting.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top