Previous Index Next

BridgePlus.framework, SMSForder Class Methods

Category

Cocoa to AppleScript conversion methods

Method

ASifyFrom:

Summary

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.

Signature

+ (id)ASifyFrom:(id)anItem

Parameters

anItem = a Cocoa item

Result

An AppleScript equivalent if available (but it will still need coercion from NSAppleEventDescriptor)

Availability

Version 1.0.0

Notes

If possible, use BridgePlus script library’s ASify from command instead.

Sample

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"


Click here to open script in a script editor