I made a droplet that moves the dropped items to a specified folder.
When I drop an alias on it, the alias stays where it was and the original item moves instead. How do I get the alias to move instead of the originalitem?
I don’t have this problem when I select the items then double-click the droplet. Why?
Actually, I already “jigged” the part where it deletes the dropped folder if it’s empty. I didn’t want to make you read the top 97% or the bottom 2% of he script, so I cut it off. Trust me- you’re glad I did.
So, “set the_items to the selection” was the answer, hey?
5 little words! Why does it always seem obvious AFTER I’m told? I’ll try using the ol’ noggin’ a little more next time.
Thanks-a-million for your help. These boards are great.
Gary
I thought of that, but the I’m not exactly sure how to add it to the script and still have it process the the other items correctly. Here’s a piece of my script.—>
on open theItems
tell application "Finder"
activate
repeat with thisItem in theItems
if the kind of thisItem is "folder" and size of thisItem is 0.0 then
delete thisItem
else if the kind of thisItem is "folder" then
get every folder of thisItem
repeat with an_item in the result
if size of an_item is 0.0 then
delete an_item
end if
end repeat
try
move thisItem to folder (number_date) in folder "Daily Folder"
on error
get name of thisItem
set this_item_name to result
display dialog "An item with the name " & this_item_name & "
already exists in this location....BLAH, BLAH...
end open
I can’t seem to get the script to work with the “selection” instead of “thisItem” and still process the folders.
Hi, Gary.
OK. It just needed a couple of ‘end ifs’ sorting out. The following version moves files, aliases, and occupied folders to the specified folder. Empty folders are deleted, as are empty folders within a folder. I’ve rejigged the script a little so that if a dragged folder contains only empty folders, it’s deleted too. (Hope that’s OK…) You’ll still need to define ‘(number_date)’.
Let me know how it goes.
NG
on open
tell application "Finder"
activate
set theItems to the selection
repeat with thisItem in theItems
set deleted to false -- this is set to true below if the item is deleted
-- If thisItem's a folder...
if the kind of thisItem is "folder" then
-- delete any empty folders it contains
get every folder of thisItem
repeat with an_item in the result
if size of an_item is 0.0 then
delete an_item
end if
end repeat
-- if it was or is now empty, delete it
if size of thisItem is 0.0 then
delete thisItem
set deleted to true
end if
end if
-- Move surviving items
if not deleted then
try
move thisItem to folder (number_date) of folder "Daily Folder"
on error
get name of thisItem
set this_item_name to result
display dialog "An item with the name " & this_item_name & "already exists in this location....BLAH, BLAH... "
end try
end if
end repeat
end tell
end open