Michael Tsai on the Precedence of ‘or’ in AppleScript

I’ve gone back and tested it on 10.5, and Tsai is correct that my original script, although it ran without error, wasn’t doing what I thought it was doing. And I concur with his suggestion that this is the most AppleScript-y way to do it:

if _browser is not in {"Safari", "WebKit"} then

This syntax also has the advantage of scaling better if you’re comparing against more than just two strings. I’ve edited my previous entries on this technique accordingly.

Wednesday, 16 September 2009