Escribí el siguiente script en Applescript en Snow Leopard e intenté usarlo en Mountain Lion, pero fue en vano (no funciona). El script observa una carpeta en busca de archivos agregados y, si el tipo de archivo coincide, lo enviará a un servidor.
Funciona muy bien, sin errores en Snow Leopard. Cuando se ejecuta en ML, escupe el error (en la consola):
AppleScript Runner: CPSGetFrontProcess(): This call is deprecated and should not be called anymore.
Estoy casi seguro de que esto tiene algo que ver con la forma en que está escrito el guión. Intenté copiar y pegar en un nuevo script en Mountain Lion y luego guardarlo. Tampoco funciona.
Aquí está el código en sí, ¿alguna idea de qué llamada funciona mal?
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
esto podría solucionarlo, en su defecto, puede publicar el contenido de los archivos plist desde ~/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
Cajunluke
Entonces, vuela