• 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
Automatic parameter coercions when calling
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Automatic parameter coercions when calling


  • Subject: Automatic parameter coercions when calling
  • From: Dave <email@hidden>
  • Date: Wed, 29 Dec 2010 19:44:30 -0600

As far as I can determine, and with help from Shane and his book, here are the automatic parameter conversions performed by the Applescript bridge when you pass a parameter to Obj-C methods or handlers in another script:

  Applescript Value Objective-C Parameter
  missing value any object: will be passed as nil
  integer, real C basic numeric types: int, float, double, short, long, long long, unsigned short, unsigned long, unsigned long long
  integer, real foundation fypes: NSUInteger, NSInteger
  integer, real  Obj-C type: id  - will be passed as a NSNumber subclass
  text NSMutableString *, NSString *
  text SEL  (must be in Obj-C selector form: "methodName:arg2:arg3:")
  boolean BOOL
  record NSMutableDictionary *, NSDictionary *
  list NSMutableArray *, NSArray *
  list struct NSRange, struct NSRect, struct NSSize, struct NSPoint


I haven't tested to see if passing to a NSNumber, or one of its subclasses, works. If so the following line should be added.
  integer, real NSNumber *  (or subclass?)

Any corrections or additions would be appreciated. 

It would be nice to have an inverse table on how returned values can be used. From what I understand there are no automatic coercions but it would be nice to have a list of what coercions can be done to which types.

-- Dave

 _______________________________________________
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

  • Follow-Ups:
    • Re: Automatic parameter coercions when calling
      • From: Shane Stanley <email@hidden>
  • Prev by Date: Re: Can't invoke NSApplication's terminate
  • Next by Date: Re: Automatic parameter coercions when calling
  • Previous by thread: Re: Can't invoke NSApplication's terminate
  • Next by thread: Re: Automatic parameter coercions when calling
  • Index(es):
    • Date
    • Thread