AppleScript error code -1708

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

AppleScript error code -1708 Mon Apr 13, 2015 3:05 pm • by ctphoto
Hazel seems to be working fine until it gets to the AppleScript, getting this error:

OSAScript error: {
OSAScriptErrorNumberKey = "-1708";

Any ideas?
ctphoto
 
Posts: 15
Joined: Thu Apr 09, 2015 2:23 pm

Re: AppleScript error code -1708 Mon Apr 13, 2015 4:31 pm • by Mr_Noodle
Can you post details about your script?
Mr_Noodle
Site Admin
 
Posts: 11867
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: AppleScript error code -1708 Mon Apr 13, 2015 4:38 pm • by ctphoto
set this_file to choose file
try
tell application "Image Events"
-- start the Image Events application
launch
-- open the image file
set this_image to open this_file
-- perform the manipulation
flip this_image with horizontal
-- save the changes
save this_image with icon
-- purge the open image data
close this_image
end tell
on error error_message
display dialog error_message
end try
ctphoto
 
Posts: 15
Joined: Thu Apr 09, 2015 2:23 pm

Re: AppleScript error code -1708 Tue Apr 14, 2015 11:23 am • by Mr_Noodle
Is this an embedded or external script? Also, you need to do any UI stuff (like "choose file") in a tell to "System Events". As Hazel runs in the background, it can't do UI stuff directly.
Mr_Noodle
Site Admin
 
Posts: 11867
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: AppleScript error code -1708 Tue Apr 14, 2015 11:46 am • by ctphoto
This is what I am trying to do.

We do flatbed scans of artwork. The file is saved to a customer folder on a shared drive. I would like the file as soon as it is saved to have its metadata changed reflecting that we (my business name) did the scanning of the artwork. The metadata I am talking about is the info I (or anyone else) would see when doing a "get file info" in Photoshop, not a finder window, the IPTC info.

The scanner software does not have any options to "embed" this info on the fly.

I know Hazel can narrow down the choice of files by using Device Make and Device Model so it only performs the script on files from the scanner, that works fine, is just that I want to run "a script" to embed my IPTC info into the file. That is where I get lost, a newbie at scripting.
ctphoto
 
Posts: 15
Joined: Thu Apr 09, 2015 2:23 pm

Re: AppleScript error code -1708 Wed Apr 15, 2015 10:52 am • by Mr_Noodle
I think you misunderstood. You can't just have "set this_file to choose file" by itself. It has to be wrapped in a "tell" block to System Events like:
Code: Select all
tell application "System Events"
    set this_file to choose file
end tell


Also, still need to know whether this script is embedded or external.
Mr_Noodle
Site Admin
 
Posts: 11867
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: AppleScript error code -1708 Wed Apr 15, 2015 11:01 am • by ctphoto
I apologize for my lack of knowledge but the script is embedded. Please be patient with me.
ctphoto
 
Posts: 15
Joined: Thu Apr 09, 2015 2:23 pm

Re: AppleScript error code -1708 Thu Apr 16, 2015 2:28 pm • by Mr_Noodle
Incorporate the change I suggested earlier. Also, you might want to get it working outside of Hazel first.
Mr_Noodle
Site Admin
 
Posts: 11867
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support

cron