• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Yosemite
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Yosemite


  • Subject: Yosemite
  • From: Shane Stanley <email@hidden>
  • Date: Fri, 17 Oct 2014 10:00:56 +1100

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/>

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Prev by Date: Re: Terminal Window Resize or Bust
  • Next by Date: [ANN] Yosemite jumps on Everyday bandwagon
  • Previous by thread: Re: Terminal Window Resize or Bust
  • Next by thread: [ANN] Yosemite jumps on Everyday bandwagon
  • Index(es):
    • Date
    • Thread