 |
 |
image events applescript
|
 |
|
 |
|
Junior Member
Join Date: May 2002
Status:
Offline
|
|
Why doesnt this do anything?
set this_file to choose file
set target_path to "newimage.jpg"
tell application "Image Events"
launch
set this_image to open this_file
save this_image as JPEG in target_path with icon
close this_image
end tell
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Oct 2000
Location: Midwest
Status:
Offline
|
|
You identify a fiile to manipulate in the first line, creating a reference (alias) to the path to the file. In the second line, you create a string witha variable name of newimage.jpg. This not not a reference to a file or a path.
You used < http://www.apple.com/applescript/imageevents/03.html> as a template. I would delete your second line and add these lines there-
Code:
set target_folder to choose folder as string
set target_file to (target_folder & "newimage.jpg" as alias.)
Your new file needs to be a reference, so the name needs to be a path reference that refers to or points to the file. The second line suggested creates an filepath alias which is a reference.
HTH
Craig
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status:
Offline
|
|
That probably won't work. You can only create an "alias" reference to an existing file, not to one that you've not yet created. The "file" class has no such restriction, and is usually just as valid asa file reference. So, this is probably more likely to work (but untested):
Code:
set target_file to file (target_folder & "newimage.jpg" as string)
|
|
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: May 2002
Status:
Offline
|
|
I am now trying the script below but getting the following error:
NSCannotCreateScriptCommandError
set this_file to choose file
set target_folder to (choose folder) as string
set target_file to file (target_folder & "newimage.jpg" as string)
tell application "Image Events"
launch
set this_image to open this_file
save this_image as JPEG in target_file with icon
close this_image
end tell
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Nov 2003
Location: Rockville, MD
Status:
Offline
|
|
Originally posted by patzoul:
I am now trying the script below but getting the following error:
NSCannotCreateScriptCommandError
set this_file to choose file
set target_folder to (choose folder) as string
set target_file to file (target_folder & "newimage.jpg" as string)
tell application "Image Events"
launch
set this_image to open this_file
save this_image as JPEG in target_file with icon
close this_image
end tell
What happens if you change:
Code:
save this_image as JPEG in target_file with icon
to this:
Code:
save this_image as JPEG in file target_file with icon
by inserting the word "file"?
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |