Re: Sending non-string parameters to an AppleScript
Re: Sending non-string parameters to an AppleScript
- Subject: Re: Sending non-string parameters to an AppleScript
- From: Jeremy Dronfield <email@hidden>
- Date: Mon, 24 Jul 2006 09:23:05 +0100
On 23 Jul 2006, at 6:08 pm, Mike Abdullah wrote:
Use somethign like this:
NSAppleEventDescriptor *xCoordinate = [NSAppleEventDescriptor
descriptorWithInt32: myPoint.x];
NSAppleEventDescriptor *yCoordinate = [NSAppleEventDescriptor
descriptorWithInt32: myPoint.y];
NSAppleEventDescriptor *newPoint = [NSAppleEventDescriptor
listDescriptor];
[newPoint insertDescriptor: xCoordinate atIndex: 1];
[newPoint insertDescriptor: xCoordinate atIndex: 2];
Then pass newPoint off to your script. Your script might have to
do a little work to reassemble the point into something the Finder
can understand.
In fact, you could probably wrap the above up into a Category for
NSAppleEventDescriptor for something like descriptorWithPoint:
Thanks. Yes, it turns out that Ken Ferry's categories do something
similar to this. My misunderstanding was assuming that AppleScript
was capable of coercing point (and similar) values from strings (i.e.
that there was stuff under the hood which would do something
equivalent to NSPointFromString().)
In case anyone else has this difficulty, the required categories
(plus script handler methods) can be got here:
<http://homepage.mac.com/kenferry/software.html#KFAppleScript>
Jeremy
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden