How do I pinpoint where the error is in Applescript?
Whenever I got an error from osascript
, it looks like this:
698:699: syntax error: Expected end of line, etc. but found identifier. (-2741)
How can I figure out where this error is (a general approach)? I don't have 698 lines in my code, and commenting every line out isn't very practical.
Solution 1:
Run it in the Script Editor, the error will highlight.
Example using image of a random script from an earlier answer
Solution 2:
I honestly would not do much in AppleScript if it were not for the amazing debugger that Late Night Software offers.
- https://latenightsw.com/
The free tier is super powerful and I’ve never regretted paying for the full version when it saves me time and headache. Not only does it show the error location, it has contextual help to guide you on fixing the error.