help need to "read from file until xxxx OR yyyy OR zzzz"

Randy Padawer padawer at mindspring.com
Sun Dec 12 17:09:09 EST 2004


Hi, I would appreciate any help anyone may offer. Let's say a text 
file occasionally includes the words dogs, cats, and fleas. I need to 
"read until" any of these words without skipping any. I tried the 
following instruction, but of course that doesn't work:

open file FileName
     repeat
         read file FileName until "dogs" or "cats" or "fleas"
         -- (do something with it in found order)
     if it is empty then exit repeat
close file FileName

Unfortunately though, so far as I can tell, this script as-is 
(obviously so wrong) reads in the whole file and doesn't stop on any 
of the words.

I played with the "seek to"  command but that requires a number 
afterward... otherwise I would "seek to" all three of the keywords in 
question and then "read to" whichever came soonest and then repeat.

Can anybody point the way? Thanks again,

Randy


More information about the use-livecode mailing list