Previous | Index | Next |
Cocoa to AppleScript conversion methods
ASifyFrom:forTypes:
Similar to ASIfyFrom:, but you can control which classes get converted. The string you pass can be comma- or space-delimited.
If it contains the word reals, floating-point numbers will be converted to reals.
If it contains the word dates, NSDates will be converted to AS dates.
If it contains the word data, NSData will be converted to AS data.
If it contains the word files, NSURLs will be converted to AS files («class furl»).
So this: set theList to (current application's SMSForder's ASifyFrom:anArray forTypes:"files, dates, reals") as list
is the same as: set theList to current application's SMSForder's ASifyFrom:aList as list
+ (id)ASifyFrom:(id)anItem forTypes:(NSString *)typesString
anItem = a Cocoa item
typesString = a string; see summary
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 forTypes:"dates, files"
theResult as date
--> date "Monday, 23 November 2015 at 12:16:19 PM"