Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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
share|improve this question
    
What line is the script executing when it throws that error? –  CajunLuke Aug 21 '12 at 23:30
    
Not sure, haven't spent much time on it in ML yet, was having a friend test for me. Just got my own ML box, going to test & post results here. –  SoFLy Aug 22 '12 at 0:38

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
share|improve this answer
    
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 :) –  SoFLy Sep 11 '12 at 17:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.