newbie script question re Find command

Timothy Miller gandalf at doctorTimothyMiller.com
Wed Mar 23 01:58:01 EDT 2011


On Mar 22, 2011, at 3:30 PM, J. Landman Gay wrote:
> Off the top of my head:
> 
> put "thing to find" into tVar
> repeat
> find tVar [in field "thisField"]
> if the result = "not found" then exit repeat
> put the foundchunk & cr after tFoundList
> end repeat
> 
> This will go through all the cards and fields by itself. I didn't test it, so you do that. ;) I probably forgot something.
> 
> Note that if you interrupt the find command it will lose its place, so let the repeat loop continue until it's done.

Thanks again Jacque.

As usual, I kludged my way through.

I'm not sure why, but in your suggested script, the result never = "not found" so it repeats forever.
So, I added three lines:

repeat
put the number of this card into firstNum -- first added line
find tVar in field "thisField"
put the number of this card into secNum -- second added line
if the result = "not found" then exit repeat
if firstnum > secnum then exit repeat -- third added line
put the foundchunk & cr after tFoundList
end repeat

That works. There's probably a better way.

I've got another question, sort of related, but I'll start a new thread for that.

Best regards,

Tim


More information about the use-livecode mailing list