Re: Save in Image Events
Re: Save in Image Events
- Subject: Re: Save in Image Events
- From: Jay Louvion <email@hidden>
- Date: Wed, 14 Dec 2005 19:15:49 +0100
Title: Re: Save in Image Events
On 14/12/05 17:57, "Luther Fuller" <email@hidden> wrote:
> I have been trying to write a script to convert image files this
> morning. After spending too much time getting it to work, I was
> successful, but noticed some problems with the 'save' command. Here's
> a simplification of the script:
>
> tell application "Image Events"
> launch
> set theImage to open fileAlias
> save theImage as TIFF in destFolder -- for example
> -- other types have the same problems
> close theImage
> end tell
>
> And the problems are:
> 1. The dictionary shows that 'save ...' returns an alias,
> but it returns nothing. The result is undefined.
> 2. If the original file has an extension, even an incorrect one,
> the new TIFF file will have the correct .tiff extension.
> However, if the original file has no extension, then the new
> file will have no extension and the Finder will not recognize
> the new file as an image.
> (But one may add the correct extension manually.)
>
> (The work-around is to rename the original file with the correct
> extension. I may do this later today.)
>
> I'm thinking that these problems are a bug and I'm wondering if
> anyone else has had a similar experience with Image Events' 'save'
> command. Has anyone submitted a bug report about this?
Check this bit of quickly corrected script to get the idea; I think you might have missed out that the save command needs the reference to a file, not a folder. About the extension thing, yep, it’s annoying I agree and needs a manual workaround (which I think you were already thinking of).
tell application "Finder"
set onefile to choose file without invisibles
set OneFileName to name of onefile as text
set LDFolder to make folder with properties {name:"LDfiles"} in container of onefile
set OneFileName to "New_" & OneFileName as text
tell application "Image Events"
launch
set this_image to open onefile
scale this_image to size 400
set TheFinalFileString to (LDFolder & OneFileName as string)
save this_image in file TheFinalFileString with icon
close this_image
end tell
end tell
HTH,
J.
Jay Louvion
Studio Casagrande
3, rue Müller-Brun
1208 Geneva
T+4122 840 3272
F+4122 840 3271
skypeme:
jaylouvion
www.studiocasagrande.com
P Please consider the environment before printing this email.
_______________________________________________
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