Re: How can I use the document Class from Image Capture Scripting ?
Re: How can I use the document Class from Image Capture Scripting ?
- Subject: Re: How can I use the document Class from Image Capture Scripting ?
- From: Emile Schwarz <email@hidden>
- Date: Mon, 07 Mar 2005 12:00:10 +0100
Hi Emmanuel et al.,
thank you for your kind answer. I've made the first half of the understanding
and had a crash in my mind for the second part. Your answer let me resume and go
to the end of the job.
See far below the corresponding code (it does nothing excepted to report width,
height and resolution of the selected file).
Cheers,
Emile
email@hidden wrote:
> Date: Sat, 5 Mar 2005 21:38:36 +0100
> From: Emmanuel <email@hidden>
> Subject: Re: How can I use the document Class from Image Capture Scripting ?
> To: AppleScript Users List <email@hidden>
> Message-ID: <p06002002be4fc7c6876f@[10.0.1.2]>
> Content-Type: text/plain; charset="us-ascii" ; format="flowed"
>
> At 1:00 PM +0100 3/5/05, Emile Schwarz wrote:
>
>> 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).
>
>
>
> The "reference" term used in the dictionary really refers to a "document".
When you "open" an alias with Image Capture Scripting, "open" returns a
"document" (I mean, I suppose it does.) When you want, say, to rotate an image,
you really apply "rotate" to a "document" you've previously opened. And when
you're done you should "close" the documents you have opened.
>
> That's what AppleScript was supposed to be designed for, and what it does
best IMHO: controlling an application's objects. So, it's rather generic to have
commands to *make* new objects, to *delete* one, and to *manipulate* it.
Creating an object happens most often, either from scratch, or from a document
saved on disk. In order to refer to the object you've created, the creation
commands return a reference that you can use later.
>
> Emmanuel
Get the width, height and resolution of the user selected image:
tell application "Image Capture Scripting"
-- Ask the user to choose an image file
tell application "Finder"
set zeFile to choose file
end tell
-- open the file as image
set myImg to open zeFile
-- get the width, height and resolution properties
set zeWidth to "width: " & width of myImg & return
set zeHeight to "height: " & height of myImg & return
set zeResolution to "resolution: " & resolution of myImg
tell current application
-- set the calling application frontmost
activate
-- report the properties
display dialog zeWidth & zeHeight & zeResolution
end tell
-- close the opened image
close myImg
end tell
_______________________________________________
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