• 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: How Do I Handle NSNumber Returned in ASObjC?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How Do I Handle NSNumber Returned in ASObjC?


  • Subject: Re: How Do I Handle NSNumber Returned in ASObjC?
  • From: Jim Underwood <email@hidden>
  • Date: Mon, 13 Jun 2016 03:24:30 +0000
  • Thread-topic: How Do I Handle NSNumber Returned in ASObjC?

Shane,

This is totally awesome!  Many thanks for your reply.

If this is not already in your book, may I suggest that you add it to the next edition?

BTW, I will be posting my final scripts/handlers for dynamic use of AppleScript Records in the next day or so.
IMO, this is huge, because it removes one major disadvantage of using AppleScript vs JXA/_javascript_ (JS objects (aka "records") are very powerful).

Best Regards,

 

Jim Underwood

aka JMichaelTX


From: <applescript-users-bounces+jmichael=email@hidden> on behalf of Shane Stanley <email@hidden>
Date: Sun, Jun 12, 2016 at 7:04 PM
To: "ASUL (AppleScript)" <email@hidden>
Subject: Re: How Do I Handle NSNumber Returned in ASObjC?

So after you have checked for missing value:

  set theResult to theDict's objectForKey:pKeyStr
  set someArray to current application's NSArray's arrayWithObject:theResult
  return item 1 of (someArray as list)

What this does is makes a single-item array containing theResult. When that's converted to an AppleScript list, the item within it will also be converted to an AppleScript item if it can. So this covers all the bridgeable AS classes -- text, numbers, lists, records, whatever. You then extract the item from the list.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: How Do I Handle NSNumber Returned in ASObjC?
      • From: Shane Stanley <email@hidden>
References: 
 >How Do I Handle NSNumber Returned in ASObjC? (From: Jim Underwood <email@hidden>)
 >Re: How Do I Handle NSNumber Returned in ASObjC? (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: How Do I Handle NSNumber Returned in ASObjC?
  • Next by Date: Re: How Do I Handle NSNumber Returned in ASObjC?
  • Previous by thread: Re: How Do I Handle NSNumber Returned in ASObjC?
  • Next by thread: Re: How Do I Handle NSNumber Returned in ASObjC?
  • Index(es):
    • Date
    • Thread