View previous topic :: View next topic |
Author |
Message |
Zeitenwanderer Newbie
Joined: 26 Feb 2002 Posts: 10
|
Posted: Thu Feb 28, 2002 8:47 pm Post subject: Read documents line-by-line to be used as single parameters |
|
|
Hi,
I would need to read a txt-file containing maybe 100 lines, each line should become a parameter to be sent one by one to a window.
Anybody have source or an idea how to do that?
Cheers,
Jörg |
|
Back to top |
|
|
SnarlingSheep Professional Member
Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Thu Feb 28, 2002 9:54 pm Post subject: |
|
|
Maybe something like this.
__________________________________________________________________________________________________________________________
Code: |
LIST CREATE,1
REM Load your text file into List #1
LIST LOADFILE,1,C:\Path\TextFile.txt
%%Number = 0
repeat
REM Change this to send the current line of text to your Window.
REM Not sure how you want it sent,
REM If as regular text try: WINDOW SEND,@WINEXISTS(WindowTitleHere),@ITEM(1,%%Number)
info Send to window: @ITEM(1,%%Number)
REM Increase %%Number by 1 to move to the next line of text.
%%Number = @SUCC(%%Number)
until @EQUAL(%%Number,@COUNT(1))
|
_________________ -Sheep
My pockets hurt... |
|
Back to top |
|
|
bjdavis Valued Newbie
Joined: 03 Jan 2002 Posts: 28 Location: Jacksonville, FL
|
Posted: Fri Mar 01, 2002 12:15 am Post subject: |
|
|
You will also need to step through each item of the list
Code: |
******* Modified code written by: SnarlingSheep ************
LIST CREATE,1
REM Load your text file into List #1
LIST LOADFILE,1,C:\Path\TextFile.txt
REM ********************************
REM Added By: B.J. Davis
REM Start at the TOP of the List 1
REM If the list is NOT Empty
If @Greater(@Count(1),0)
REM ********************************
%%Number = 0
repeat
REM Change this to send the current line of text to your Window.
REM Not sure how you want it sent,
REM If as regular text try: WINDOW SEND,@WINEXISTS(WindowTitleHere),@ITEM(1,%%Number)
info Send to window: @ITEM(1,%%Number)
REM Increase %%Number by 1 to move to the next line of text.
%%Number = @SUCC(%%Number)
REM *********************************
REM Added By: B.J. Davis
REM Move to the Next Item in the List
%%NextItem = @Next(1)
REM *********************************
until @EQUAL(%%Number,@COUNT(1))
REM ********************************
REM Added By: B.J. Davis
REM If List 1 is Empty your code will move to this point
END
REM ******************************** |
_________________ B.J. Davis, MCSE |
|
Back to top |
|
|
SnarlingSheep Professional Member
Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Fri Mar 01, 2002 1:51 am Post subject: |
|
|
@ITEM(1,%%Number) will return the item in List 1 at position %%Number.
No need for SEEK or @NEXT() _________________ -Sheep
My pockets hurt... |
|
Back to top |
|
|
bjdavis Valued Newbie
Joined: 03 Jan 2002 Posts: 28 Location: Jacksonville, FL
|
Posted: Fri Mar 01, 2002 4:30 am Post subject: |
|
|
You are correct ... I overlooked that line. 8O Thanks _________________ B.J. Davis, MCSE |
|
Back to top |
|
|
Zeitenwanderer Newbie
Joined: 26 Feb 2002 Posts: 10
|
Posted: Fri Mar 01, 2002 8:10 pm Post subject: Does the trick it seems |
|
|
Well, yes, this seems to do the trick. Thanks to you two guys. I doubt, I would have ever made it that far
Now I am tricking around the other part. Stay tuned and keep the way you are!!!
Yours grateful,
Jörg (pronounce George) |
|
Back to top |
|
|
|