Page 1 of 1

Stop/Restart Hazel from AppleScript

PostPosted: Thu Feb 04, 2010 2:39 pm
by Emanu
Hello there,

Is there a way to programmatically stop and restart Hazel from AppleScript or a shell script?

TIA

Cheers
-Emmanuel

Re: Stop/Restart Hazel from AppleScript

PostPosted: Thu Feb 04, 2010 8:02 pm
by sjk
I'd try the killall HazelHelper shell command, possibly adding a -SIGNAL option.

Re: Stop/Restart Hazel from AppleScript

PostPosted: Fri Feb 05, 2010 12:10 pm
by Mr_Noodle
I think the best way now is to have AppleScript record you manipulating the menu item.

Re: Stop/Restart Hazel from AppleScript

PostPosted: Fri Feb 05, 2010 12:25 pm
by Emanu
Hmm, I'm a little bit weary to use a kill command against Hazel.

The other solution provided by Paul seems to me more kosher.

But I think it could be nice to expose more Hazel to AppleScript so to be able to start/stop Hazel, or start/stop specifics rules from AppleScript.

Cheers
-Emmanuel

Re: Stop/Restart Hazel from AppleScript

PostPosted: Fri Feb 05, 2010 2:51 pm
by sjk
And/or make HazelHelper process do the "right" thing when its sent SIGTERM or other signals? :)

Re: Stop/Restart Hazel from AppleScript

PostPosted: Mon Feb 08, 2010 5:30 pm
by Mr_Noodle
It's not right to kill the helper process. When you start/stop Hazel, it doesn't kill anything (notice that the helper is still running). The helper process just stops scheduling runs. The reason you shouldn't kill the helper is that it does other stuff as well so other things will stop working if you do that. In addition, there may be issues with starting it yourself afterwards.

Re: Stop/Restart Hazel from AppleScript

PostPosted: Mon Feb 08, 2010 5:58 pm
by sjk
Thanks for the detailed explanation. I retract my earlier thoughts about possibly signaling the HazelHelper process. :)