View previous topic :: View next topic |
Author |
Message |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Mon Nov 25, 2002 1:08 am Post subject: LIST LOADFILE question |
|
|
hello
i have been playing with the LIST LOADFILE it works ok BUT i notice if you have a text box that display what is in the txt file you load and if the txt file has more then one line of text in it. It don't display it in the text box is there a way to have it display ONE line at a time then clear it then read second line of txt file,etc and have it display this in the text box? also to AS it reads each line of the text file have it store this to a var. |
|
Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Mon Nov 25, 2002 1:22 am Post subject: and |
|
|
also to i see LIST LOADFILE don't like var... that or i'am doing somethimg wrong  |
|
Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Mon Nov 25, 2002 3:22 am Post subject: |
|
|
I don't quite understand what you are trying to do by loading the text one line at a time.
As far as list loadfile,... not liking variables, I ususlly have to use the @shortname() function.
Post an example for me.
Bill _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
|
Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Mon Nov 25, 2002 3:43 am Post subject: ok |
|
|
ok i have it reading one line at a time BUT if i have a big file it only read the first line then it stops and the var problem i will work on that after i get it to read the whole file
here is what i have
this code here i have so i can see it read the txt file line by line ( this is in my dilalog window
Code: |
DIALOG ADD,LIST,tim,170,0,552,22
|
then i have this code THAT READS small txt file fine but when i have a big txt file it reads the first line then stops
Code: |
:button1button
LIST CREATE,tim
list clear,tim
list loadfile,tim, c:\test.txt
list seek,tim,0
repeat
%A = @next(tim)
IF %A
dialog cursor,%A
wait 1
END
until @null(%A)
|
thanks |
|
Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Mon Nov 25, 2002 3:50 am Post subject: grrrrrrrrrrrrrr |
|
|
i know why it stops
cuase if you have spaces in the txt file meaning this:
tim
tim 1
tim 2
it stops on the spaces any way to fix that so it reads the spaces?
thanks |
|
Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Mon Nov 25, 2002 3:51 am Post subject: |
|
|
Tim wrote:
Code: | :button1button
LIST CREATE,tim
list clear,tim
list loadfile,tim, c:\test.txt
list seek,tim,0
repeat
%A = @next(tim)
IF %A
dialog cursor,%A
wait 1
END
until @null(%A)
|
Here's the way I'd do this:
Code: |
:Button1BUTTON
list create,1
list loadfile,1,C:\Text.txt
if @greater(@count(1),0)
%x = 0
repeat
list seek,1,%x
%A = @item(1)
if @not(@null(%A))
dialog cursor,%A
wait 1
else
dialog cursor
end
%x = @succ(%x)
until @equal(%x,@count(1))
end
list close,1
goto Evloop
|
Does this help?
Bill _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Mon Nov 25, 2002 3:53 am Post subject: |
|
|
What do you mean read spaces? If the empty string only contains spaces do something or not do something? _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Mon Nov 25, 2002 3:55 am Post subject: yea |
|
|
if there are spaces in the txt info..is there a way to have it skip the space so it won't stop? |
|
Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Mon Nov 25, 2002 3:56 am Post subject: |
|
|
if you use %A = @trim(@item(1)), it will return the text without the return or any preceeding spaces up to the first letter in the list item. _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Mon Nov 25, 2002 3:59 am Post subject: |
|
|
Code: |
:Button1BUTTON
list create,1
list loadfile,1,C:\Text.txt
if @greater(@count(1),0)
%x = 0
repeat
list seek,1,%x
%A = @trim(@item(1))
if @not(@null(%A))
dialog cursor,%A
wait 1
else
dialog cursor
end
%x = @succ(%x)
until @equal(%x,@count(1))
end
list close,1
goto Evloop
|
I'm afraid that's all I can come up with. I thought about checking %A to see if it had @chr(32) in it but that would be a bad thing because there is always the possibility of having a @chr(32) in a line of text.
If you are creating the text file, just omit the empty lines. _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it."
Last edited by ShinobiSoft on Mon Nov 25, 2002 4:06 am; edited 1 time in total |
|
Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Mon Nov 25, 2002 4:04 am Post subject: hummmm |
|
|
hummm i added that line like you say and it still stops BUT it stops on a line that DON't have spaces next
i look thru the txt file and some of the data is like this:
tim 1
tim2
tim3
tim3
tim4 |
|
Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Mon Nov 25, 2002 4:08 am Post subject: yea |
|
|
txt file is made by other non-vds program  |
|
Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Mon Nov 25, 2002 4:12 am Post subject: |
|
|
The only other thing I can think of is to loop through the whole file looking for @cr()'s @chr(9) and removing them with @strdel() before looping through the file to view it's contents.
Maybe someone else has a better idea!?  _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Mon Nov 25, 2002 4:18 am Post subject: i got it workimng :) |
|
|
i got it working now
how to make LIST LOADFILE work with varibles? meaning this
LIST LOADFILE ,tim, %T
thanks |
|
Back to top |
|
 |
|