AppleScript dialog not working in Hazel

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

AppleScript dialog not working in Hazel Wed Sep 12, 2012 6:43 am • by Jono
I'm using the latest version of Hazel and the AppleScript "display dialog" isn't working for me. I stripped everything else out and just set Hazel to run the following if a file was added to a folder;

Code: Select all
display dialog "Test Message"


It doesn't work for me on the latest versions of Mountain Lion and Lion. Does anyone else encounter this problem?

I've also also had problems with Hazel using AppleScript and MountainNotifier (CLI tool for Notification Centre messages). If I run the AppleScript "normally" (not through Hazel) is works fine, and if I run it through Hazel as a shell script it also works fine. I only get the problem using it with AppleScript through Hazel.
Jono
 
Posts: 26
Joined: Wed May 09, 2012 5:52 am
Location: UK

Re: AppleScript dialog not working in Hazel Wed Sep 12, 2012 11:46 am • by Mr_Noodle
Since AppleScripts are being called from a background process, you can't really use any UI stuff directly. You have to tell another app to do it. In this case, you can use SystemEvents as follows:
Code: Select all
tell application "System Events"
   ...your code here...
end tell
Mr_Noodle
Site Admin
 
Posts: 11551
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: AppleScript dialog not working in Hazel Wed Sep 12, 2012 12:06 pm • by Jono
Ah, I'm glad it was something simple. Thanks!
Jono
 
Posts: 26
Joined: Wed May 09, 2012 5:52 am
Location: UK


Return to Support