Page 1 of 1

AppleScript Newbie Problems

PostPosted: Fri Oct 21, 2016 5:50 am
by mtennes
Hazel constantly reports an error when attempting to run a very simple non-embedded AppleScript.
Code: Select all
property theFile : alias "Users:Michael:Desktop:DEVON.pdf"

tell application "Finder" to open file theFile
While, if I embed the tell "Finder"... line it works in Hazel.

What am I doing wrong? Ultimately, I want to automatically store various PDF's in DevonThink Pro Office.

Re: AppleScript Newbie Problems

PostPosted: Fri Oct 21, 2016 10:34 am
by Mr_Noodle
If writing an external script, you must use a special handler. Consult the help as it has a template there.

Re: AppleScript Newbie Problems

PostPosted: Sun Oct 23, 2016 8:24 pm
by mtennes
Mr_Noodle wrote:If writing an external script, you must use a special handler. Consult the help as it has a template there.


It appears this is a limitation within Hazel using the OSA Applescript component rather than the Generic OSA component. See discussion below.

http://forum.latenightsw.com/t/debugging-hazel-applescript/331/6

Re: AppleScript Newbie Problems

PostPosted: Mon Oct 24, 2016 11:07 am
by Mr_Noodle
I'm not sure the comment is correct. Hazel does use the generic OSA APIs (which is how it can support JavaScript as well). Also, that has little bearing on why there is a separate handler, which is by design.

Re: AppleScript Newbie Problems

PostPosted: Sat Oct 29, 2016 10:20 am
by mtennes
Mr_Noodle wrote:I'm not sure the comment is correct. Hazel does use the generic OSA APIs (which is how it can support JavaScript as well). Also, that has little bearing on why there is a separate handler, which is by design.


I am absolutely sure my previous comment was not correct. Hazel scripts do work with Script Debugger when it's set up correctly. Make sure your have the ~/Library/Components directory in place with correct permissions before running Script Debugger (my problem.)