ASObjCExtras.framework


ASObjCExtras has been deprecated in favor of the BridgePlus scripting library, which provides the same facilities and more, in a more convenient form. Read more here.


ASObjCExtras is a free framework that fills in some of the gaps in AppleScriptObjC support, as well as providing some useful extra facilities including methods for efficiently processing lists and strings.

It is primarily aimed at scripters using AppleScriptObjC in Yosemite and ASObjC-based script libraries in Yosemite and Mavericks, but can also be used by those writing applications in Xcode.

The framework can be installed by dragging it to either ~/Library/Frameworks/ or /Library/Frameworks/. It can also be embedded in script bundles and applets in a /Contents/Frameworks/ directory, or added to an Xcode project.

The framework's methods are mostly class methods of a single class, SMSFord, and belong to several groups.

The first group are methods for converting between AppleScript and Cocoa. AppleScript handles conversion between text, numbers, booleans, lists and records and their Cocoa counterparts, but it has two key shortcomings:

* There is no conversion of dates.

* When floating-point numbers are returned as NSNumbers, coercing them to reals involves a loss of precision.

ASObjCExtras addresses these issues, and also offers conversions between AppleScript's files and Cocoa's NSURLs, and between AppleScript data and Cocoa's NSData. The two main methods are +Cocoaify:, which converts from AppleScript to Cocoa, and ASify, which is an instance method that converts the other way round.

The second group of methods are for string manipulation, and are based on similar facilities offered by ASObjC Runner. They cover making dates from strings, applying ICU transforms, handling CSV and TSV text, and several other text modification shortcuts.

The third group are for list manipulation, and are also based on ASObjC Runner. Manipulating long lists can be very inefficient in AppleScript, and these methods provide an array of fast shortcuts.

The fourth group provide basic trignonometry and log facilities.

The final miscellaneous group provides methods for efficiently retrieving file information, and for extracting metadata from image files.

You can download the latest version of the framework (1.2.3), along with some samples, here.

Update: You can download well-known scripter and blogger Takaaki Naganoya's comprehensive English-language manual here.

You can use and distribute this framework free of charge. There are no guarantees or warranties whatsoever. Use at your own risk.