"Put Away" action?

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

"Put Away" action? Tue Feb 10, 2009 1:00 am • by bosley
The main reason I'd like to use Hazel is to keep my desktop tidy - and free of files other than aliases. I created a rule which replaces a file on the desktop with its alias and moves that file to a repository. However what I'd like it to do instead is to "put away" the file back to its original location (if dragged/moved - not created there). I believe that Mac OS 9 had this "put away" feature.

Any ideas? Any ideas on how to completely disallow any non-alias file from being moved to the desktop?
bosley
 
Posts: 4
Joined: Tue Feb 10, 2009 12:54 am

Re: "Put Away" action? Tue Feb 10, 2009 6:41 pm • by Mr_Noodle
By the time Hazel sees a file, it's too late in that it does not know where it came from. Unfortunately, I can't think of a good way to do what you want.
Mr_Noodle
Site Admin
 
Posts: 11250
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: "Put Away" action? Wed Feb 11, 2009 5:02 pm • by bosley
You know what? I was just brainstorming and researching Finder "Put Away" online. And I'm going to try AppleScript and ~ "tell Finder undo". I'll see if it works.

Phil
bosley
 
Posts: 4
Joined: Tue Feb 10, 2009 12:54 am

Re: "Put Away" action? Wed Feb 11, 2009 7:02 pm • by bosley
Using AppleScript, System Events, and undo does work. It's not ideal. 2. It appends " alias" which I don't think it did before. 2. And it no longer obeys the position at which I had dropped the file. But it does work. Anybody have any comments?

If kind is not alias:
1. Run AppleScript -> embedded script

Code: Select all
set app_name to "Finder"

tell application "Finder"
   activate
end tell

tell application "System Events"
   tell process app_name
      keystroke "z" using command down
   end tell
end tell


2. Make alias in folder Desktop

(Click the checkbox labeled "Enable access for assistive devices" in the Universal Access System Preference pane)
bosley
 
Posts: 4
Joined: Tue Feb 10, 2009 12:54 am

Re: "Put Away" action? Wed Feb 11, 2009 7:06 pm • by bosley
One addition problem though perhaps is how to differentiate whether to tell the Finder to undo when moving a file to the desktop vs simply saving/creating a file on the desktop. Comments?
bosley
 
Posts: 4
Joined: Tue Feb 10, 2009 12:54 am

Re: "Put Away" action? Tue Feb 17, 2009 2:57 pm • by Mr_Noodle
Ah, yes, clever use of the undo. As for differentiating, you can try looking at the created date but then that wouldn't catch cases where a file is created and immediately moved to the Desktop but if that doesn't happen often, then that might be a good criteria to use.
Mr_Noodle
Site Admin
 
Posts: 11250
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support