Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the '10.6: Gather Finder Items with a new Service' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.6: Gather Finder Items with a new Service
Authored by: jazzbri on Mar 10, '11 08:45:08AM
Another method, using this script:

	tell application "Finder" to set the this_folder to (folder of the front window) as alias
on error -- no open windows
	set the this_folder to path to desktop folder as alias
end try

tell application "Finder"
	set selected_items to selection
	set thefoldername to text returned of (display dialog "Folder name:" default answer "new folder")
	set theFolder to (make new folder at this_folder with properties {name:thefoldername}) --added "set theFolder to.."
	repeat with x in selected_items
		move x to theFolder
	end repeat
end tell
I run this script from Butler (tied to a Shift-Option-N keyboard shortcut). It's worked perfectly for me for years :)

[ Reply to This | # ]
10.6: Gather Finder Items with a new Service
Authored by: Frederico on Mar 10, '11 09:21:36AM

I wonder if Craig shouldn't change the Hint title to reflect this script/Service's unique ability to play in forbidden folders?

I was using similar scripting myself, but, as I stated, this did not allow me to create folders directly inside the Trash (.trash) folder.

You work around the aforementioned -1700 permissions errors by tossing the newly created target folder onto the Desktop, which is fine, I guess, for you, but for my workflow it adds yet another manual step to close the Trash, go locate the new folder on the Desktop, and then move it where I want it -- which may very well be in the very location I am already working, including the Trash.

A similar burden is placed on me if I am in the /System or /Library or /Applications folders, which, admittedly, is not something most users will do, but many advanced users will be in the several-levels-deep, normally-off-limits System folder, reorganizing various components for troubleshooting needs.

My script/Service (also invoked by Keystroke) gives me an automatic, guaranteed unique, sortable folder name, leaves the target where I am working, and preselects it on the assumption I wish to take further action on it -- which for me regularly includes yet another Service (also by Keystroke) to move the folder to a specified location, obviating the need to drag it manually.

Looking at your script, I could remove the dialog and add my code to auto-name it; and I could also add code to predict the need to move the new folder back into the Trash as needed, and it would indeed have met the Vanilla AppleScript goals. Interesting food for thought.

PS: I note that you use a Repeat function to move your items; this is slow (with a large list) and unnecessary; a single batch move as I have done in my script will move them all in one shot.

Thanks for the feedback.


[ Reply to This | # ]
10.6: Gather Finder Items with a new Service
Authored by: jazzbri on Mar 10, '11 09:28:04AM

You're right about the repeat being slooooow when contending with a bunch of files. I still like my keyboard shortcut... I'll work your service into it and have the best of both worlds :)

[ Reply to This | # ]