which item contains the foundText?

Rich Lague laguer at ucs.orst.edu
Mon Sep 20 01:40:56 EDT 2004

I’m making an application that keeps it’s data in a text file and I’m 
trying build in a find field. So, I set up a script for the field:

on returnInField
   global tVar  -- contains the text file
   global itemNum -- a handler in the stack script uses this to display 
the current record
   if me is empty then beep -- nothing to find
   find the text of me in tVar
-- now I need to get the item number that the text was found in.

-- the script below does not work. I also tried “is within”--also 
doesn’t work.
   set the itemDelimiter to "|"
   repeat with i = 1 to the number of items in tVar
     if i contains the foundText then
       put i into itemNum
       exit repeat
     end if
   end repeat

  put itemNum

end returnInField

So...How do I determine which item my foundText is in?


Rich Lague

More information about the use-livecode mailing list