Previous | Index | Next |
Cocoa to AppleScript conversion methods
ASifyFrom:
Converts any NSDates to AS dates, NSURLs to files («class furl»), and any floating-point numbers to reals, to work around the imprecision of the built-in conversion. Result must still be coerced.
Typical use: set theList to current application's SMSForder's ASifyFrom:anArray as list
Bridge does the conversion under 10.11 and later.
As above, but returns the result in a single-item list. Use this when unsure of the class of the result, and extract the first item from the result coerced to a list. Works around coercion problem.
+ (id)ASifyFrom:(id)anItem
anItem = a Cocoa item
An AppleScript equivalent if available (but it will still need coercion from NSAppleEventDescriptor)
Version 1.0.0
If possible, use BridgePlus script library’s ASify from command instead.
use scripting additions
use framework "Foundation"
use script "BridgePlus"
load framework
set anItem to current application's NSDate's |date|()
set theResult to current application's SMSForder's ASifyFrom:anItem
theResult as date
--> date "Monday, 23 November 2015 at 12:12:27 PM"