Why does this AppleScript not run in Outlook? I would like set up an inbound rule in Outlook to run applescript on certain messages.

However the rule fails with the following message:

While processing message "Test" (ID 39523), the rule "untitled" could not be successfully executed. An unknown error has occurred in Outlook.


I've tried with scripts that different things, such as displaying a dialog in another application:

Tell application "Adobe Illustrator" to display dialog "hallo"


or in Outlook itself:

Tell application "Microsoft Outlook" to display dialog "hallo"


or do a shell action:

do shell script "touch /Users/cesansim/Desktop/iamapony.txt"


and all of them work OK when launched from the command line via osascript, but do not from within Outlook.

Also, other actions (for example setting the message to read) run by rules work OK. Is it possible that on my corporate Mac there's a security setting blocking AppleScript? And how do I turn that off?

Thanks.
The script does not get recognized by Outlook as such because it has been saved as text (I created it inside Aquamacs).

If I open it in the AppleScript Editor and export it as script, then it works.

I found the solution here (third message from the top)