Add AppleScript Support FOR Hazel

Talk, speculate, discuss, pontificate. As long as it pertains to Hazel.

Moderators: Mr_Noodle, Moderators

Add AppleScript Support FOR Hazel Wed Aug 20, 2014 2:03 pm • by dredhorse
Hi,

would be cool to be able to control Hazel via Applescript, like turn it on off, enable / disable a rule

after that you could of course go wild like enable rule creation etc, but the above would be the most useful for me atm :D
Regards

Don
dredhorse
 
Posts: 20
Joined: Mon Aug 11, 2014 4:39 pm

Re: Add AppleScript Support FOR Hazel Thu Aug 21, 2014 12:27 am • by Allsop
+1 for Applescript support.
Allsop
 
Posts: 67
Joined: Thu May 01, 2014 1:43 am

Re: Add AppleScript Support FOR Hazel Thu Aug 21, 2014 12:17 pm • by Mr_Noodle
Can you provide specific cases for this? It helps to have that to determine whether the feature is worth doing and how it should be implemented.
Mr_Noodle
Site Admin
 
Posts: 11240
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Add AppleScript Support FOR Hazel Sat Aug 23, 2014 11:34 am • by dredhorse
for example:

I have a SD card where I store my developing projects and where I also work with them (mainly to cut down on constant write access of the storage due to git, compile etc.)

But I would like to run a copy job of changed files to a backup area (maybe even zip stuff up) in certain intervals, let's say every 24 hours.

As I have Keyboard Maestro I could trigger an apple script regularly to enable that specific rule on that folder.

The other reason would be to disable hazel when the battery runs low and enable it again when the laptop is charging.
Regards

Don
dredhorse
 
Posts: 20
Joined: Mon Aug 11, 2014 4:39 pm

Re: Add AppleScript Support FOR Hazel Mon Aug 25, 2014 2:02 pm • by Mr_Noodle
If you want it to run at intervals, you can use the Current time attribute for that. As for stopping, is there a reason you can't do it via the menubar icon?
Mr_Noodle
Site Admin
 
Posts: 11240
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Add AppleScript Support FOR Hazel Mon Aug 25, 2014 3:52 pm • by dredhorse
concerning the starting / stopping..... CMD + H is faster than using the icon in the bartender menu bar :D

will look into the time stuff later.
Regards

Don
dredhorse
 
Posts: 20
Joined: Mon Aug 11, 2014 4:39 pm

Re: Add AppleScript Support FOR Hazel Tue Aug 26, 2014 1:54 pm • by dredhorse
hmm the current time attribute is quite nice for once a day, but if I want to run it every 30 minutes it is quite cumbersome.
Regards

Don
dredhorse
 
Posts: 20
Joined: Mon Aug 11, 2014 4:39 pm

Re: Add AppleScript Support FOR Hazel Tue Aug 26, 2014 3:50 pm • by Mr_Noodle
You can also use "Date last matched is not in the last X minutes" if you don't care about specifically when it fires, just how frequently.
Mr_Noodle
Site Admin
 
Posts: 11240
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Add AppleScript Support FOR Hazel Tue Sep 02, 2014 7:19 am • by dredhorse
thanks for that information... forgot about that..
Regards

Don
dredhorse
 
Posts: 20
Joined: Mon Aug 11, 2014 4:39 pm

Re: Add AppleScript Support FOR Hazel Fri Jan 23, 2015 11:30 am • by GadgetComa
I'd like to add a +1 to this along with a use case:

I want to be able to automate the creation of new rules in Hazel. Specifically, I want to create an AppleScript that:
  • Prompts that user to locate a folder within their Dropbox folder.
  • Adds the selected folder to Hazel's folder list
  • Imports a rule for that folder

Background: I've built a separate script that relies on Hazel. I've made it available for public use. Some people have trouble setting up the rule in Hazel, so I'd like to automate the process.

Perhaps there is already a way to do this that I've overlooked?

Regards,

- Leon
GadgetComa
 
Posts: 5
Joined: Wed Jul 30, 2014 8:19 am


Return to Open Discussion