I've written the following script in Applescript in Snow Leopard, and I tried to use it in Mountain Lion, but to no avail (doesn't work). The script watches a folder for added files, and if the filetype matches, it will scp it to a server.

It runs great, no errors on Snow Leopard. When it's run in ML it spits back the error (in console):

AppleScript Runner: CPSGetFrontProcess(): This call is deprecated and should not be called anymore.

I'm almost positive this has something to do with the way the script is written. I have tried copying & pasting into a new script in mountain lion, and then saving that. Doesn't work either.

Here is the code itself, any insight as to what call is working wrong?

on adding folder items to this_folder after receiving the_files
--set login vars
set fileExt to "zip"
set scpIP to "blah"
set scpUser to "blah"
set scpDest to "/home/blah"
set scpPort to "1234"
--repeat on each file that is added to the folder
repeat with each_file in the_files
set filename to name of (info for each_file)
tell application "Finder"
--check extension, if match, scp. else, error.
if name extension of each_file is fileExt then
try
do shell script "scp -p" & scpPort & " " & scpUser & "@" & scpIP & ":" & scpDes
move each_file to trash
end try
end if
end tell
end repeat
end adding folder items to

1 Answer
1

this might fix it, failing that can you post the contents of the plist files from ~/Library/LaunchAgents

on adding folder items to this_folder after receiving the_files
--set login vars
set fileExt to "zip"
set scpIP to "blah"
set scpUser to "blah"
set scpDest to "/home/blah"
set scpPort to "1234"
--repeat on each file that is added to the folder
repeat with each_file in the_files
set filename to name of (info for each_file)
--check extension, if match, scp. else, error.
if name extension of each_file is fileExt then
try
do shell script "scp -p" & scpPort & " " & scpUser & "@" & scpIP & ":" & scpDes
tell application "System Events" to move each_file to trash
end try
end if
end repeat
end adding folder items to

Thanks for the comment - I actually posted on another forum and ended up with this exact script, which worked. There is a bizarre (and poorly documented, surprise) issue within OSX that spits back a depreciated call regardless of what code is there for this type of script. The script was too slow, so I gave in and am writing a menu bar application to do the same, it'll be a bit more robust :)
–
SoFLySep 11 '12 at 17:08