Script as Application in Application Scripts

Okay, last question for the evening:

As I recall, under Lion I was able to use a script compiled as an .app as an action in a Mail rule; as of Mountain Lion, with scripts required to be placed in ~/Library/Application Scripts, applications are no longer recognized.

Is this change documented anywhere?

Have a look at http://support.apple.com/kb/PH11788?viewlocale=en_US&locale=en_US.

But basically Scripts must be located in ~/Library/Application Scripts/com.apple.mail.

Sorry, I wasn’t clear. In Lion and previous, a script.app could be used as a Mail rule action. In Mountain Lion and Mavericks, that is no longer the case—Mail does not see the applet in ~/Library/Application Scripts/com.apple.mail, but does see script.scpt and script.scptd. Is this change documented? Would code signing the applet change this behavior?

Hi,

application scripts must be in format .scpt oder .scptd.
Apple introduced application scripts to be able to run user scripts without restrictions from sandboxed applications.
The executing Cocoa class NSUserAppleScriptTask does not accept AppleScript applets and returns a
The file “Applet” couldn’t be opened because it isn’t in the correct format.
error

And my question was “Is this change documented?”

Right, I get that. I’m just trying to find the relevant documentation.

It’s not really documented.
I tried to open an applet with NSUserAppleScriptTask and it threw the mentioned error

Thanks, I suppose it doesn’t really matter. Script bundles give me pretty much what I wanted, anyway, except that I can’t get past the privilege violation error when I include an osax in the bundle.

Have you tried to put the OSAX in its dedicated directory Contents/Resources/Scripting Additions ?

Yup! My reason for deleting/moving the osax out of /Library/Scripting Additions (where it’s needed so Script Editor can see it) is to make sure that my script is using the bundled osax. It does appear to be, but each call to my osax-provided function now generates the privilege violation.

IMO this is a bug in NSUserAppleScriptTask, and you ought to log it as such.

Hello

I don’t understand that.

As far as I know, items stored as .scpt or .scptd aren’t applications but compiled scripts.

Yvan KOENIG (VALLAURIS, France) dimanche 29 décembre 2013 10:04:13

I suspect Stefan means “application scripts” as in scripts that live in ~/Library/Application Scripts/.

Exactly

Thanks.
Now I understand.

Yvan KOENIG (VALLAURIS, France) dimanche 29 décembre 2013 17:05:24