Re: AS asking for application on every occasion
Re: AS asking for application on every occasion
- Subject: Re: AS asking for application on every occasion
- From: Thierry Lavallée <email@hidden>
- Date: Thu, 08 Jul 2004 21:19:53 -0400
Thanks all, But I still have a problem.
If I directly call GC, my script works perfectly:
tell application "GraphicConverter PPC"
But GraphicConverter has different names in different versions it seems.
If I set graphicConverterPath to application file id "GKON" as string, some
parts of my script do not pass syntax error check. I get "a property can't
go after this property" near "set color space of window 1 to rgb".
As if some of the properties were not accessible the same way.
So this does not work:
tell application "Finder"
set graphicConverterPath to application file id "GKON" as string
end tell
tell application graphicConverterPath
Below is my whole script just so someone can check it out.
Thanks!
--
Thierry
--------------------------------------------------------------
set OriginalPath to "20 Go:Documents:Ressources:Images_Clip
Arts:Photos:LOW:CC000009.JPG"
set ScaledPath to "20 Go:Documents:1347:724_M.jpg"
set myRotate to false
set myAngle to 0 -- angle is CCW
set MaxWidth to 760
set MaxHeight to 500
tell application "Finder"
set graphicConverterPath to application file id "GKON" as string
end tell
tell application graphicConverterPath
--tell application "GraphicConverter PPC"
activate
-- open the file
with timeout of 0.5 seconds
set GotitThrough to false -- may get here too early; changing window
repeat until GotitThrough
try
open OriginalPath without messages
set GotitThrough to true
on error
delay 0.5
end try
end repeat
end timeout
-- Get the image info
with timeout of 0.5 seconds
set GotitThrough to false -- may get here too early; changing window
repeat until GotitThrough --needs to "settle down"
try
set color space of window 1 to rgb
change resolution of window 1 to {72, 72} without
recalculate
get image dimension of window 1
set info to (image dimension of window 1)
set GotitThrough to true
on error
delay 0.5
end try
end repeat
end timeout
-- THIS SEEMS TO TAKE TOO LONG
set imageWidth to (item 1 of info)
set imageHeight to (item 2 of info)
if imageWidth > MaxWidth or imageHeight > MaxHeight then
if imageWidth / MaxWidth > imageHeight / MaxHeight then
-- Set by the height
set myscale to (round (MaxHeight / imageHeight * (10000))) /
10000
else
-- Set by the width
set myscale to (round (MaxWidth / imageWidth * 10000)) / 10000
-- 10000 will round with 2 decimal
end if
set x to (scale window 1 horizontal myscale vertical myscale)
set x to (sharpen edges of window 1 to 12)
if myRotate is true then set x to (rotate window 1 to angle myAngle
with with dither)
end if
save window 1 in (ScaledPath) as JPEG
close window 1 without saving
-- quit without saving
end tell
tell me to activate
--------------------------------------------------------------
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.