lineoffset

DunbarX at aol.com DunbarX at aol.com
Fri Nov 6 18:37:32 EST 2009


Rick.

Silly us, I think. Your text in which to search is only the first item of 
the storage field:

on mouseUp
   set itemdel to "|"
   get the clicktext
   put lineoffset (it, item 1 of cd field "storage")
end mouseUp

You are trying to find the clicktext in the first item of that field. 
Probably not much text there. Test with text that you know is in that very first 
item.

One of my first forays into rev was to rewrite Frederic Rinaldi's 
"fullFind", because I constantly need to find every instance of a word and its line 
numbers. If you are interested, try calling this and see if it gives any 
results. Or you might try your original script with very simple words. If it 
works, then you have spelling problems, or, more likely, hidden chars that are 
preventing the find from succeeding.

on mouseUp
    set itemdel to "|"
    get the clicktext
    put revFullFind fld "storage",it,"lineNum","true"
end mouseUp



function revFullFind tText,tFind,form,exactly
    switch
       case exactly = "true" and form = "lineNum"
          repeat for each line tline in tText
             add 1 to counter
             if tFind = tline then
                put counter & return after temp22
             end if
          end repeat
          break
       case exactly = "true" and form = "txt"
          repeat for each line tline in tText
             add 1 to counter
             if tFind = tline then
                put theLine & return after temp22
             end if
          end repeat
          break
       case exactly = "false" and form = "lineNum"
          repeat for each line tline in tText
             add 1 to counter
             if tFind is in tline then
                put counter & return after temp22
             end if
          end repeat
          break
       case   exactly = "false" and form = "txt"
          repeat for each line tline in tText
             add 1 to counter
             if tFind is in tline then
                put theLine & return after temp22
             end if
          end repeat
          break
    end switch
    return temp22
end revFullFind

Craig Newman




More information about the use-livecode mailing list