How can I use the document Class from Image Capture Scripting ?
How can I use the document Class from Image Capture Scripting ?
- Subject: How can I use the document Class from Image Capture Scripting ?
- From: Emile Schwarz <email@hidden>
- Date: Sat, 05 Mar 2005 13:00:57 +0100
Hi all,
The dictionary of the Image Capture Scripting application have 5 commands and a
Class.
The class name is document with three properties: width, height and resolution
(all integers, all r/o).
It was _easy_ to figure out how to use the Commands, but I have troubles using
the document Class (I can't use it).
Did you have any idea to share ?
Thanks,
Emile
BTW: asking questions is fine; giving answers to asked questions is fine too;
but providing explanations (for free) is better. Here’s a gift to thank this
list (and I hope it helps).
PS: AppleScript create an icon and set it to the saved image. It also adds in
the file Comments the file width, height and resolution. Here's an example:
<from a resized image comment field>
width/height: 200 x 140
resolution: 72.0 dpi
</from a resized image comment field>
Here's an example to how rotate an image:
[beware of the line wrapping]
tell application "Image Capture Scripting"
-- Ask the user to choose a source image file
tell application "Finder"
set zeFile to choose file
end tell
-- open the file as image
set myImg to open zeFile
-- rotate the image *
rotate myImg to angle 90.0
-- ask the user for a new name/location (target file)
tell application "Finder"
set zeNewFile to choose file name default name "Rotated Image.jpg"
end tell
-- save the rotated image
save myImg in zeNewFile
-- close the opened image
close myImg
-- get back to the Script Editor
tell current application
activate
end tell
end tell
* The angle value is a real (thus the ending .0) and its range seems to be from
0 to 360. A positive rotation value produce a Clock Wise (CW) rotation; a
negative value produce a Counter Clock Wise (CCW) rotation.
To scale an image, replace the rotate line by either:
-- Ask for a scale _by factor_
scale myImg by factor 0.5
if the factor is 1, no scale will be done; if the factor is greater than 1, the
image size will be increased, if the factor is lower than 1, the image size will
be decreased.
-- Ask for a scale _to size_ (max width/length)
scale myImg to size 200
if myImg width is greater than myImg height, the image will be resized using 200
as the width and the height is resized using the original w/h ratio. If myImg
height is greater than myImg width, Image Capture Scripting will use 200 as the
height...
_______________________________________________
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