Applescript -10810 Error
I have to run an applescrip开发者_如何学Pythont that convert images with "image events" and I have to run the script with PHP.
If I run the script with command line in terminal or from AppleScript editor, all works correctly, but if I try to run the script with shell_exec or exec PHP command -10810 error happens.
This is the code. The Error happens at the "open" command of "Image Events" but also happens at first command of every application.
on run {myFoto, myThumb}
try
set myTmpWidth to 1772
set myFoto to "Macintosh HD:Library:WebServer:Documents:imgProdotti:alta:" & myFoto
set myThumb to "Macintosh HD:Library:WebServer:Documents:imgProdotti:alta:" & myThumb
set myWidth to myTmpWidth * 1
tell application "Image Events"
set myImage to open myFoto
tell myImage
scale to size myTmpWidth
save as JPEG in myThumb
close
end tel
end tell
on error error_message
return error_message
end try
end run
Someone can help me?
set myImage to open myFoto
^
|
You're basically trying to open a string, which you can't do. When you initiliaze myFoto
, coerce it into an alias reference like so:
set myFoto to "Macintosh HD:Library:WebServer:Documents:imgProdotti:alta:" & myFoto as alias
Do the same thing for the myThumb
variable; you will get an error otherwise.
Also (this might just be a typo) there is a compilation error at line 15: end tel
精彩评论