Jump to content

JavaScript is the new automation language in Yosemite


Recommended Posts

Take a look at this link:

 

https://t.co/Y9TDhanIA7

 

Yosemite supports using JavaScript instead of AppleScript as a scripting language. It's a complete replacement with all of the same features and integrations with Objective-C frameworks. You can run it with osascript, etc.

 

Since I'm posting this in the feature suggestions you can guess what I'm requesting when Alfred is run on Yosemite. :-)

Link to comment
Share on other sites

Will Alfred need to specifically accommodate the change, though? I seem to recall reading that said javascript would be executed via osascript, anyway, so it should work as is.

 

I believe it will. I'm not sure if NSAppleScript will run JavaScript. The screenshots of the Script Editor show the user having to select either AppleScript or JavaScript.

Link to comment
Share on other sites

Wouldn't have been my first (or even fourth) choice as a new scripting language of OS X, but it sure is a massive improvement on AppleScript.

 

Man, I hate that language. This is one time I'll be happy to reimplement loads of my code in a new language.

 

I don't hate AppleScript but I've never been able to completely understand it's syntax. I always have to experiment to fully understand how to use an app's dictionary of functions and properties. JavaScript, on the other hand, is very, very clear, extremely flexible, and thanks to the browser wars, very fast.

Link to comment
Share on other sites

I don't hate AppleScript but I've never been able to completely understand it's syntax. I always have to experiment to fully understand how to use an app's dictionary of functions and properties. JavaScript, on the other hand, is very, very clear, extremely flexible, and thanks to the browser wars, very fast.

That's why I hate it. The syntax is incomprehensible.

 

I wonder how fast JavaScript will run as a scripting language. The scripting bridge is hideously slow. Fingers crossed they've done something about that, but I'd be surprised if JS runs noticeably faster than AS, regardless of how fast JS VMs have become.

 

Do you know anything about Apple's JS runtime? I'm guessing it won't have the kind of IO features etc. that node does.

Link to comment
Share on other sites

That's why I hate it. The syntax is incomprehensible.

 

I wonder how fast JavaScript will run as a scripting language. The scripting bridge is hideously slow. Fingers crossed they've done something about that, but I'd be surprised if JS runs noticeably faster than AS, regardless of how fast JS VMs have become.

 

Do you know anything about Apple's JS runtime? I'm guessing it won't have the kind of IO features etc. that node does.

 

The comparison isn't JavaScriptCore to Node, it's JavaScriptCore to V8. There is at least one implementation of Node.js on top of JavaScriptCore, not sure how usable it is though. I'd very much like to see a benchmark of Node.js on top of Yosemite's JavaScriptCore.

Link to comment
Share on other sites

  • 2 months later...

BTW: JavaScript for Application Automation is available in the open Yosemite Beta. My Alfred on my Yosemite beta system does not run JavaScript in the AppleScript script block. The osascript program runs it fine. Therefore, just a new "run" block will be needed. AppleScript has not disappeared. It is still usable. Therefore, everything does not have to be converted, at least not soon.

Link to comment
Share on other sites

I don’t think deanishe said that in a sense of having to change the code, but more in a sense of being glad to get rid of all the code of his that still uses a loathsome language (that he was essentially forced to write, as there wasn’t any alternative at the time). I very much agree, although I also agree that javascript isn’t necessarily a great language choice (it is, however, an understandable pick, and definitely an improvement).

Link to comment
Share on other sites

  • 3 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...