------------------------------------------------------------------------------------------------
try
set p2me to path to me
set ptaf to path to applications folder
tell application "Finder"
set p2cofme to container of (path to me) as text
if exists folder (ptaf & "Mail Manager" as text) then move folder (ptaf & "Mail Manager" as text) to trash
set folderPath to (p2cofme & "Mail Manager") as alias
duplicate folderPath to ptaf
end tell
on error e number n
set e to e & return & return & "Num: " & n
tell me to set dDlg to display dialog e with title "ERROR!" buttons {"Cancel", "Copy", "OK"} default button "OK"
if button returned of dDlg = "Copy" then set the clipboard to e
end try
------------------------------------------------------------------------------------------------
Hmm. Changing duplicate to move compiles just fine here on my machine (10.8.2), and it works correctly when run.
------------------------------------------------------------------------------------------------
try
set p2me to path to me
set ptaf to path to applications folder
tell application "Finder"
set p2cofme to container of (path to me) as text
if exists folder (ptaf & "Mail Manager" as text) then move folder (ptaf & "Mail Manager" as text) to trash
set folderPath to (p2cofme & "Mail Manager") as alias
move folderPath to ptaf
end tell
on error e number n
set e to e & return & return & "Num: " & n
tell me to set dDlg to display dialog e with title "ERROR!" buttons {"Cancel", "Copy", "OK"} default button "OK"
if button returned of dDlg = "Copy" then set the clipboard to e
end try
------------------------------------------------------------------------------------------------
For testing I had the script and folder saved here:
~/Desktop/Brian_Script_Folder/
Brian_Script.app
Mail Manager/
--
Best Regards,
Chris