Re: External script handler return value will not cast to number
Re: External script handler return value will not cast to number
- Subject: Re: External script handler return value will not cast to number
- From: Shane Stanley <email@hidden>
- Date: Mon, 03 Jan 2011 21:19:25 +1100
- Thread-topic: External script handler return value will not cast to number
On 3/1/11 5:46 PM, "Dave" <email@hidden> wrote:
> set aNumber to current application's ObjCClass's returnValue()
> log aNumber -- 100
> log aNumber's |class|() -- NSObject
You might find it useful to add:
log aNumber's class -- <NSAppleEventDescriptor: 'doub'>
IOW, the scripting bridge is essentially converting the returned float to an
AS real, presumably because AS doesn't understand anything but objects.
The difference with the call to the AS handler is that the AS integer 100 is
presumably converted to an NSNumber when passing from the AS handler *to*
Cocoa, and hence is returned unchanged.
Change your method to this and see what happens:
+ (NSNumber *) returnValue
{
return [NSNumber numberWithInt:100];
}
--
Shane Stanley <email@hidden>
'AppleScriptObjC Explored' <www.macosxautomation.com/applescript/apps/>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden