On Jul 7, 2011, at 3:58 PM, Inyo55 wrote: > I am trying to return an error message if I script a find command in > applescript using BBEdit. That is, if the searched string is not present in the > text being searched, I want the script to display an error message and cancel > the script. > > My syntax is: > > try > find sigfindname searching in text 1 of text document 1 options {search > mode:literal, starting at top:false, wrap around:false, backwards:false, case > sensitive:false, match words:false, extend selection:false} with selecting > match > on error errmsg > display dialog errmsg > end try > > sigfindname is a variable for a string created upstream in the script. > > The applescript totally ignores my command in the TRY statement. Any > suggestions? I also tried using an IF/THEN command using a FALSE result > returned, but that did not work either. Hi Bob, I've run into something similar before, and found that this approach works around the problem: set itemNotFound to true -- default try find sigfindname searching in text 1 of text document 1 options {search mode:literal, starting at top:false, wrap around:false, backwards:false, case sensitive:false, match words:false, extend selection:false} with selecting match set itemNotFound to false end try if itemNotFound then display dialog "Some error message." end if HTH, Stan C.