Feedback: comparing content of two fields
    Ronald Zellner 
    zellner at tamu.edu
       
    Thu Apr 28 23:04:45 EDT 2011
    
    
  
OK, slight modification of Peter's  script:
on mouseUp
   local allEntries, ruralEntries, theStart
   put the seconds into theStart   -- used to check the timing
    put fld "All" into allEntries
    put fld "Rural" into ruralEntries
    set the itemDelimiter to tab
    repeat with x = 1 to the number of lines in allEntries -- there are 1247 lines
          if cr & (item 1 of line x of allEntries) & tab is in  ruralEntries then
                   put "Rural" into item 4 of line x of field "All"
                   set the textColor of line x of field "All" to "red"
                  next repeat    -- I had "end repeat" before.
             else
                   put "-" into item 4 of line x of field "All"
          end if
    end repeat
   put the seconds - theStart & return after field "TheTime"  -- get elapsed time
end mouseUp
This script checks the variable and alters the field content & line color.
This took 432 seconds to complete.
Then I changed it to alter the contents of the variable. 
Had to remove the color change as you can't set that attribute- as Michael predicted.
    put "Rural" into item 4 of line x of allEntries
And then put the variable into the field at the end:
    put allEntries into field "All"
This took 1 second to complete. 
 I'll write a separate script to change the line color in the field.
Thanks all.
    
    
More information about the use-livecode
mailing list