How to Test Hazel AppleScripts in AppleScript Editor

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

This is probably old news for those of you that know a thing or two about AppleScript, but it's been helpful to me.

After quite a bit of testing and trying different techniques, I think I finally found the easiest way to test how Hazel will process a given file by running it through AppleScript Editor with this snippet at the top:
Code: Select all
property theFile : alias "Path:To:Your:Example File.extension"


That's for embedded AppleScripts. For external ones, also include this after that:

Code: Select all
hazelProcessFile(theFile)
 
on hazelProcessFile(theFile)
--Your external Hazel script goes here.
end hazelProcessFile


I wrote this up as a brief blog post here: http://n8henrie.com/2013/02/how-to-test-hazel-applescripts-in-applescript-editor/ but I figured it might also do some good for me to post it here in the tips and tricks forum, as I know I've spent plenty of time digging through these threads.

Hope this helps someone!
n8henrie
 
Posts: 8
Joined: Sat Apr 30, 2011 2:27 am
Location: Albuquerque, NM

While this is great, I find that it is kind of a pain to test against multiple different files.

I do this:

Code: Select all
set theFile to choose file


To select my own files.
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado


Return to Tips & Tricks - DO NOT POST QUESTIONS