AppleScript to pause / resume Hazel?

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

Moderator: Mr_Noodle

AppleScript to pause / resume Hazel? Thu Aug 29, 2019 10:42 am • by luomat
https://www.noodlesoft.com/forums/viewtopic.php?p=2798 is pretty old and was the only reference I came across while searching for this.

There are times when I would like to quickly pause Hazel, do something, and then resume Hazel again¹

Is there a way to do that using AppleScript or some other reliable form of automation?

Before you ask: I don’t have Hazel shown in my menu bar (which is already overcrowded, even with Bartender) so that isn’t an ideal solution for me.

¹ (Generally this is to avoid Hazel asking to “uninstall” an app when all I am doing is installing an update. I don’t want to turn off Hazel’s uninstall feature entirely.)
luomat
 
Posts: 78
Joined: Wed Mar 10, 2010 3:57 pm

Re: AppleScript to pause / resume Hazel? Fri Aug 30, 2019 9:44 am • by Mr_Noodle
You can stop it using the "Stop Hazel" button in the "Info" section but there's no AppleScript way to do that short of recording events.

What's the reason for this?
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: AppleScript to pause / resume Hazel? Sat Aug 31, 2019 8:08 am • by luomat
What's the reason for this?


I have a series of scripts which will update all my non-Mac App Store apps. Part of the process if moving the old app to the trash before moving the new app in place.

I have “App Sweep” enabled, and most of the time I want it enabled, but during the upgrade process Hazel sees the app in the trash before the script finishes putting the new one in its place, so Hazel offers to uninstall the app’s other files.

I’m trying to figure out a way around that which doesn’t involve disabling App Sweep entirely.
luomat
 
Posts: 78
Joined: Wed Mar 10, 2010 3:57 pm

Re: AppleScript to pause / resume Hazel? Mon Sep 02, 2019 10:32 am • by Mr_Noodle
Is the new version downloaded and ready to be installed when you remove the old one or do you remove it beforehand? If the latter, try changing it. As long as the new version is on the same drive, swapping it out is very fast. You'll just need to have a temporary spot (on the same drive) to download it to.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: AppleScript to pause / resume Hazel? Mon Sep 02, 2019 12:09 pm • by luomat
Well, it's close to being ready, but it either needs to be unzipped or copied from a DMG.

I could copy it to a staging area but that would required updating all of my shell scripts… there's currently 350 of them.
luomat
 
Posts: 78
Joined: Wed Mar 10, 2010 3:57 pm

Re: AppleScript to pause / resume Hazel? Tue Sep 03, 2019 10:43 am • by Mr_Noodle
Yikes, there isn't some way you can modularize at least the unpacking and moving part?
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: AppleScript to pause / resume Hazel? Tue Sep 03, 2019 12:08 pm • by luomat
If I had realized there were going to be 350+ when I started the project, I probably would have figured out a way to give them some common code for unzipping/installing or mount-dmg-and-install, but my original idea was that each of these would be self-sufficient and work on a "clean install" Mac, so they are each independent little shell script islands.
luomat
 
Posts: 78
Joined: Wed Mar 10, 2010 3:57 pm


Return to Support