Stop/Restart Hazel from AppleScript

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

Moderator: Mr_Noodle

Stop/Restart Hazel from AppleScript 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
Emanu
 
Posts: 4
Joined: Thu Feb 04, 2010 2:09 pm

Re: Stop/Restart Hazel from AppleScript Thu Feb 04, 2010 8:02 pm • by sjk
I'd try the killall HazelHelper shell command, possibly adding a -SIGNAL option.
sjk
 
Posts: 332
Joined: Thu Aug 02, 2007 5:43 pm
Location: Eugene

Re: Stop/Restart Hazel from AppleScript 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.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Stop/Restart Hazel from AppleScript 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
Emanu
 
Posts: 4
Joined: Thu Feb 04, 2010 2:09 pm

Re: Stop/Restart Hazel from AppleScript 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? :)
sjk
 
Posts: 332
Joined: Thu Aug 02, 2007 5:43 pm
Location: Eugene

Re: Stop/Restart Hazel from AppleScript 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.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Stop/Restart Hazel from AppleScript 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. :)
sjk
 
Posts: 332
Joined: Thu Aug 02, 2007 5:43 pm
Location: Eugene


Return to Support