Hi I’m trying to add a folder action which copies items added to a folder to another folder. Here’s what I have but doesn’t work, can help me?
on adding folder items to this_folder after receiving added_items
tell application "Finder"
try
copy (added_items) to folder "Journler Drop Box" of folder "Journler" of folder "Application Support" of folder "Library" of folder "edoardo" of folder "Users" of startup disk
end try
end tell
end adding folder items to
“Copy” doesn’t work for files, Nestor. Use duplicate, and if you want the original to disappear, delete it. If the copy location is on the same volume, you can move it there, but if on another volume, the Finder will duplicate it anyway, even if you say “move”.
additional to Adam’s note, there is a “shortcut” for
folder "Journler Drop Box" of folder "Journler" of folder "Application Support" of folder "Library" of folder "edoardo" of folder "Users" of startup disk
if “edoardo” is the current user you can also use
folder "Journler:Journler Drop Box" of (path to application support from user domain)
property JDB : alias ((path to application support folder from user domain as text) & "Journler:Journler Drop Box")
on adding folder items to this_folder after receiving added_items
tell application "Finder" to duplicate added_items to JDB
end adding folder items to
But note: you could have just put an alias to the JDB wherever you had the folder with the action.
Just to point out that if you do it this way, the script will need to be compiled on the host machine, as the alias will be compiled into the script. For greatest flexibility, ‘path to’ “ and often ‘alias’ “ should only be used at run time.
-- global JDB -- Uncomment if global scope required.
set JDB to alias ((path to application support folder from user domain as Unicode text) & "Journler:Journler Drop Box")
Thanks: with “duplicate” everything works. The second script you wrote works perfectly but doesn’t add elements if Journler is not opened: that is why I wanted to copy to the drop box…
I’ll read the article about Applescript and Journler thx for the suggestion
Nestor;)