• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: External script handler return value will not cast to number
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >External script handler return value will not cast to number (From: Dave <email@hidden>)

  • Prev by Date: External script handler return value will not cast to number
  • Next by Date: Script Editor forces Terminate() in place of terminate()
  • Previous by thread: External script handler return value will not cast to number
  • Next by thread: Script Editor forces Terminate() in place of terminate()
  • Index(es):
    • Date
    • Thread