Hazel 3.0 Hint: Multi-Use Applescript Dialog for Option Rule

From your noodle to other noodles. Talk about ways to get the most from Hazel. Even exchange recipes for the cool rules you've thought up. DO NOT POST YOUR QUESTIONS HERE.

Moderators: Mr_Noodle, Moderators

Here is a quick little script I've been using for Hazel 3.0. Add a script-result applescript. This will give you a dialog box with any text you want. It also has the hazel icon!

Code: Select all
#don't forget that theFile is the variable for the file
set theDialogText to "This is where you are going to list instructions for the rule."
set theButtonIfPressedTheRuleWillContinue to "Continue with Rule"
set theButtonIfPressedRuleAborts to "Abort Rule"
set theDialogTitle to "Advanced Hazel Sorting"

############## This is where the magic happens ############
tell application "System Events"
   activate
   set theResult to button returned of (display dialog theDialogText with title theDialogTitle buttons {theButtonIfPressedTheRuleWillContinue, theButtonIfPressedRuleAborts} default button 1 giving up after 60 with icon (POSIX file (POSIX path of (get path to library folder from user domain) & "/PreferencePanes/Hazel.prefPane/Contents/Resources/PrefPane.icns" as string) as string) as alias) as string
end tell

if theResult is theButtonIfPressedTheRuleWillContinue then return true
return false


EDIT: Changed "beta" to "3.0"
EDIT 2: Updated the icon path
Last edited by a_freyer on Tue Dec 11, 2012 12:02 pm, edited 3 times in total.
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

May I ask what you're using this for?
I can see how this can be useful for an Action (maybe give a dialog to apply OpenMeta tags) But for a Rule?! I wonder.
Zettt
Zettt
 
Posts: 30
Joined: Wed Aug 29, 2007 8:50 am

I use this to create new sorting directories on the fly.
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

Wow! Nifty idea!
Thanks for the feedback. Much appreciated.
Zettt
Zettt
 
Posts: 30
Joined: Wed Aug 29, 2007 8:50 am

a_freyer wrote:I use this to create new sorting directories on the fly.


Sounds really interesting to be able to do that! This is like Hazel 4.0 on steroids :) Would love to see an example on how to set this up in a rule for creating new sorting directories on the fly.
musecaptain
 
Posts: 27
Joined: Tue Oct 08, 2013 2:38 pm


Return to Tips & Tricks - DO NOT POST QUESTIONS

cron