Image Events droplet
Image Events droplet
- Subject: Image Events droplet
- From: David Marshall <email@hidden>
- Date: Sun, 20 Mar 2005 14:39:48 -0500
I'm working on a script to process screenshots. The aim is to convert a
selected image file (typically "Picture 1.pdf") to a different format
(JPEG) while renaming it and moving it to a selected folder.
This works:
- - - - -
set inputFile to choose file without invisibles
set outputFile to (choose file name default name "new_name.jpg") as
string
tell application "Image Events"
launch
set inputImage to open inputFile
set outputImage to save inputImage as JPEG in file outputFile with icon
close inputImage
end tell
tell application "Finder"
delete inputFile
end tell
- - - - -
To save the script as a droplet, I changed it to:
- - - - -
on open theseFiles
set inputFile to first item of theseFiles
set outputFile to (choose file name default name "new_name.jpg") as
string tell application "Image Events"
launch
set inputImage to open inputFile
set outputImage to save inputImage as JPEG in file outputFile with
icon
close inputImage
end tell
tell application "Finder"
delete inputFile
end tell
quit
end open
- - - - -
which also works.
But I'm running into a wall trying to handle multiple files in a repeat
block. I can iterate through theseFiles, opening the choose file name
dialog for each, but I can't seem to get a reference I can use in the
Image Events block; it seems that inputImage is "not defined" in the
line "set outputImage to save inputImage as JPEG in file outputFile
with icon."
- - - - -
repeat with thisFile in theseFiles
set inputFile to thisFile
set outputFile to (choose file name default name "new_name.jpg") as
string
tell application "Image Events"
launch
set inputImage to open inputFile
set outputImage to save inputImage as JPEG in file outputFile with
icon
- - - - -
I'd appreciate any nudge in the right direction. :-)
Dave
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden