Hi, so I've been getting into applescript, and Folder Actions, and I wrote this script... Which copies all new screenshots to a variety of locations when they are added to the folder. However, when I use that script as the foundation for my next idea (if the file is a DMG file, copy to a different variety of locations), it fails.
Original Script used as foundation
http://pastie.org/private/t9vkbp5y8rvrvwqts4mciw
Last draft of failed DMG script.
http://pastie.org/private/cyuwkabayodivm9ytybw
- Also attached both scripts as images.
Does anybody have an idea about what I'm doing wrong? I'm stumped.
And yes, I name my folders/servers/external HDs after Legend of Korra / The Last Airbender characters.. I'm a geek like that.
Thanks for the help.
Original Script used as foundation
http://pastie.org/private/t9vkbp5y8rvrvwqts4mciw
Last draft of failed DMG script.
http://pastie.org/private/cyuwkabayodivm9ytybw
- Also attached both scripts as images.
Does anybody have an idea about what I'm doing wrong? I'm stumped.
And yes, I name my folders/servers/external HDs after Legend of Korra / The Last Airbender characters.. I'm a geek like that.
Code:
on adding folder items to thisFolder after receiving added_items
set OpalLoc to "Opal:Backups:DMGs"
set MingHuaLoc to "MingHua:Root:Backups:DMGs"
set GhazanLoc to "Ghazan:Backups:DMGs"
set ZukoLoc to "Tom:Users:tom:Cloud:Zuko:DMGs"
repeat with addedFile in added_items
tell application "Finder"
if exists folder OpalLoc and (the name of the addedFile ends with "dmg") then
copy file addedFile to folder OpalLoc
end if
end tell
delay 1
tell application "Finder"
if exists folder MingHuaLoc and (the name of the addedFile ends with "dmg") then
copy file addedFile to folder MingHuaLoc
end if
end tell
delay 1
tell application "Finder"
if exists folder GhazanLoc and (the name of the addedFile ends with "dmg") then
copy file addedFile to folder GhazanLoc
end if
end tell
delay 1
tell application "Finder"
if exists folder ZukoLoc and (the name of the addedFile ends with "dmg") then
copy file addedFile to folder ZukoLoc
end if
end tell
end repeat
end adding folder items to
Thanks for the help.