Page 1 of 1

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

PostPosted: Thu Oct 20, 2011 10:09 pm
by a_freyer
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

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

PostPosted: Tue Mar 06, 2012 3:15 am
by Zettt
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.

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

PostPosted: Wed Mar 14, 2012 10:45 pm
by a_freyer
I use this to create new sorting directories on the fly.

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

PostPosted: Thu Mar 15, 2012 4:13 am
by Zettt
Wow! Nifty idea!
Thanks for the feedback. Much appreciated.

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

PostPosted: Mon Feb 10, 2014 8:25 pm
by musecaptain
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.