Page 1 of 1

Recipe: Set a comment for a file

PostPosted: Fri Feb 09, 2007 9:00 pm
by IDontDoWindows
I drag urls to the desktop all the time. I want Hazel to put them away, but I also sometimes want to make a note about what the url is, or what action I want to take with the url, so that when I check out the url later I know why I saved it and what the blank I'm supposed to do with it.

Hazel first moves the urls off the desktop, then runs a script which opens the "Get Info" window for the url, and puts the cursor in the comments section. Below is the script. Note that it uses System Events, which means that in order for it to work, "Enable acess for assistive devices" has to be checked. You can do this by opening System Preferences and selecting Universal Access (in the System section of System Preferences). You will find the "Enable access..." option at the bottom of the window.

Code: Select all
my hazelProcessFile(leFiche)

on hazelProcessFile(leFiche)
   try
      tell application "Finder"
         activate
         open information window of leFiche
      end tell
      tell application "System Events"
         repeat 3 times
            keystroke tab
         end repeat
      end tell
   on error
      say "oops"
   end try
end hazelProcessFile