Hey ho, my journey of bodging together Applescripts continues. Trying to get this script to run in 10.9 - it just fails but with no errors. A quick look at the Console brings up the following message on the move command:
Finder[617]: AppleEvents/sandbox: Returning errAEPrivilegeError/-10004 and denying dispatch of event syso/nfo4 from process ‘AppleScript Editor’/0x0-0xa00a, pid=604, because it is not entitled to send an AppleEvent to this process.
Is this a sandbox problem or is the script broken? I really appreciate any advice.
set oneItem to choose file
tell application "Finder"
set theServer to "MacSSD:Users:admin:Desktop:Fake_Share:POS_LR:"
set the the_new_text to "_LR"
set {tid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, "_"}
--repeat with oneItem in these_items
set {name:Nm, name extension:Ex} to (info for oneItem)
if Ex is missing value then set Ex to ""
if Ex is not "" then
set Nm to text 1 thru ((count Nm) - (count Ex) - 1) of Nm
set Ex to "." & Ex
end if
set name of oneItem to (Nm & the_new_text & Ex)
set fileName to name of oneItem
set {theGroup, theCode, theWeek} to text items of fileName
set chain to text 1 thru 1 of theGroup
set theFolder to text 1 thru 1 of theGroup
try
set command to "/bin/mv -f " & (quoted form of (POSIX path of aPDF)) & space & (quoted form of theServer) & "Week" & (text 1 thru 2 of theWeek) & "/" & theFolder & "*/"
do shell script command
(*
on error
display dialog "wut"
*)
end try
--end repeat
set AppleScript's text item delimiters to tid
end tell