Now that it’s out, the official release notes are also available:
<https://developer.apple.com/library/mac/releasenotes/AppleScript/RN-AppleScript/RN-10_10/RN-10_10.html#//apple_ref/doc/uid/TP40000982-CH110-SW1>
I suspect the progress stuff will be well received -- a simple way of showing a script’s progress has been a request for forever. Yosemite makes it simple.
Naturally, the biggest change to my mind is this statement:
AppleScript/Objective-C is now available to all scripts
This means you can use AppleScriptObjC code anywhere in in any sort of script, and it’s self-contained — no more requirement for a script library (though they’re still a great idea, and still required if you want Mavericks compatibility). Put another way, ASObjC is now directly part of "vanilla" AppleScript. You have access to most of the stuff in the Cocoa frameworks, and then some. So arguably the change is small, in that you had this in Mavericks but only via script libraries. But in practice it's likely to be a giant leap: Cocoa at every (up-to-date) scripter's fingertips.
Here's a simple example. If you're running Yosemite, just paste this into your favorite editor and hit run (assuming you have a TextEdit document open):
use framework "Foundation" tell application id "com.apple.TextEdit" -- TextEdit set theText to text of document 1 -- make a Cocoa string set theNSString to current application's NSString's stringWithString:theText -- call Cocoa method and coerce back to AS string set theText to (theNSString's uppercaseString()) as text set text of document 1 to theText end tell
The presence of a “use framework…” statement is what tells AppleScript to look for ASObjC code.
The other thing I would suggest is that the changes in Yosemite and Mavericks make the “use AppleScript version…” statement something you need to consider adding when using any of the new features. (Which will usually mean adding “use scripting additions” as well.)
-- Shane Stanley <email@hidden> <www.macosxautomation.com/applescript/apps/>
|