Re: Image Events problem.
Re: Image Events problem.
- Subject: Re: Image Events problem.
- From: KOENIG Yvan <email@hidden>
- Date: Tue, 25 Mar 2008 09:45:46 +0100
Le 24 mars 2008 à 23:00, Shane Stanley a écrit :
On 25/3/08 1:54 AM, "KOENIG Yvan" <email@hidden> wrote:
I am writing a script driving Image Events to help an user.
I met a surprizing behavior.
What version of the OS? I ask because there seem to be some
problems with
Image Events in 10.5.x.
I met this behavior with 10.4.11
set maxSize to 640
set fichier_source to "Macintosh HD:Users:yvankoenig:Desktop:dossier
100titre:Scan - copie 1.gif"
tell application "System Events" to tell (file fichier_source)
set nomImage to name
set the_Kind to kind
set nomExt to name extension
end tell
set wasJpeg to the_Kind contains "JPEG"
with timeout of 900 seconds
tell application "Image Events"
launch
set cette_image to open file fichier_source
set {vieuxW, vieuxH} to dimensions of cette_image
if vieuxW > vieuxH then
set |échelle| to maxSize / vieuxW
else
set |échelle| to maxSize / vieuxH
end if
if wasJpeg is false then
tell application "System Events"
set dossier to (path of container of file fichier_source) as
Unicode text
if nomExt > "" then
set court to text 1 thru -(2 + (length of nomExt)) of nomImage
else
set court to nomImage
end if
if exists file (dossier & court & ".jpg") then
set nomDest to court & "_" & nomExt & ".jpg"
set fichierDest to dossier & nomDest
else
set nomDest to court & "_.jpg"
set fichierDest to dossier & nomDest
end if
end tell
if |échelle| > 1 then
set |échelle| to 1
else
scale cette_image by factor |échelle|
end if
save cette_image as JPEG in file fichierDest with icon (* this
jpeg file is NOT created *)
close cette_image
tell application "System Events" to if exists (file fichierDest)
then delete file fichier_source
end if
end tell -- Image Events
end timeout
I highlighted the instruction which is problematic.
When the file_source is a GIF one, the jpeg resize file is not created
It is correctly created with other kinds of picture files.
Yvan KOENIG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden