Can anyone tell me why this script will only run after the button is tapped twice? The answer is probably obvious but I'm at a loss. Thanks in advance.
Code: Select all
on mouseUp
   if the environment = "development" then touchEnd 1
 
  lock screen
   focus on nothing
   find empty
   put false into tExit 
   find word"test"in field "Field b"
if the foundChunk is empty then 
 put true into tExit 
 else 
replace the foundText with "replaced text"in field "Field b"
end if