Re: How Do I Handle NSNumber Returned in ASObjC?
Re: How Do I Handle NSNumber Returned in ASObjC?
- Subject: Re: How Do I Handle NSNumber Returned in ASObjC?
- From: Shane Stanley <email@hidden>
- Date: Mon, 13 Jun 2016 16:20:38 +1000
On 13 Jun 2016, at 10:04 AM, Shane Stanley <email@hidden> wrote:
>
> 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)
If you're lazy, you can also use this:
set theResult to theDict's objectForKey:pKeyStr
set someArray to current application's NSArray's arrayWithArray:{theResult}
return item 1 of (someArray as list)
The difference is that this version will cope with theResult being missing value.
But if you know the class, it's more efficient to just convert directly; this is really a back-stop for when you don't.
--
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>
_______________________________________________
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