• 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
NSAppleEventDescriptor - getting a double (and other animals)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSAppleEventDescriptor - getting a double (and other animals)


  • Subject: NSAppleEventDescriptor - getting a double (and other animals)
  • From: Luke Evans <email@hidden>
  • Date: Mon, 21 Jan 2008 20:46:48 -0800

I wish to allow my scripting interface to accept 'any' for a property. I see that this is handled in Cocoa by the relevant method being sent an object of type NSAppleEventDescriptor, and I have implemented the fairly straightforward and obvious code to handle the types string, int32 and boolean (these all being available on NSAppleEventDescriptor itself). Now, I need to implement handlers for some other types (doubles, dates). This is clearly where things kick up a gear in terms of what is required to handle them properly, and my browsing of docs so far (particularly the Cocoa Scripting Guide) has not turned up the recommended way of coercing these NSAppleEventDescriptors to appropriate objects (NSNumber, NSDate...). I could coerce everything through a string with what I have now, but I think that would be a tad naughty.

I see there's an NSScriptCoercionHandler, and I've tried messing with it (i.e. convert a numeric NSAppleEventDescriptor to an NSNumber), but given the fact it seems to hand the original object right back, I imagine that I'm misunderstanding its use (...there's not a great deal of documentation on this class).

What is the proper way to unpack NSAppleEventDescriptors when I'm after simple values like doubles and dates? (Maybe I'll deal with lists later, but I think I can already see how lists work).

-- Lwe



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Carbon-Cocoa Integration: Linking issue
  • Next by Date: Re: NSServices and NSPasteboard
  • Previous by thread: Re: Carbon-Cocoa Integration: Linking issue
  • Next by thread: Re: NSAppleEventDescriptor - getting a double (and other animals)
  • Index(es):
    • Date
    • Thread