ctwise Posted June 8, 2014 Share Posted June 8, 2014 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 More sharing options...
vitor Posted June 8, 2014 Share Posted June 8, 2014 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. Link to comment Share on other sites More sharing options...
ctwise Posted June 9, 2014 Author Share Posted June 9, 2014 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 More sharing options...
Vero Posted June 9, 2014 Share Posted June 9, 2014 Whatever the case, Alfred will definitely be updated to incorporate some of the new technologies coming into play in Yosemite Link to comment Share on other sites More sharing options...
deanishe Posted June 10, 2014 Share Posted June 10, 2014 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. rice.shawn 1 Link to comment Share on other sites More sharing options...
ctwise Posted June 10, 2014 Author Share Posted June 10, 2014 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 More sharing options...
deanishe Posted June 10, 2014 Share Posted June 10, 2014 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 More sharing options...
ctwise Posted June 10, 2014 Author Share Posted June 10, 2014 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 More sharing options...
deanishe Posted June 10, 2014 Share Posted June 10, 2014 Indeed, but the VM it's running on isn't as interesting as what libraries they may have added to it, hence why I mention node, not V8. Link to comment Share on other sites More sharing options...
raguay.customct Posted September 8, 2014 Share Posted September 8, 2014 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 More sharing options...
vitor Posted September 8, 2014 Share Posted September 8, 2014 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 More sharing options...
deanishe Posted September 8, 2014 Share Posted September 8, 2014 That's exactly what I meant. AppleScript is an awful language. Unfortunately, it looks like the strange object model will remain. Link to comment Share on other sites More sharing options...
Carlos-Sz Posted September 8, 2014 Share Posted September 8, 2014 That's exactly what I meant. AppleScript is an awful language. Unfortunately, it looks like the strange object model will remain. I really like AppleScript. rice.shawn 1 Link to comment Share on other sites More sharing options...
deanishe Posted September 8, 2014 Share Posted September 8, 2014 I really like 80's music. That doesn't mean it isn't awful… rice.shawn 1 Link to comment Share on other sites More sharing options...
Carlos-Sz Posted September 8, 2014 Share Posted September 8, 2014 I really like 80's music. That doesn't mean it isn't awful… C’mon, it isn’t. Link to comment Share on other sites More sharing options...
deanishe Posted September 9, 2014 Share Posted September 9, 2014 You're right, it's not. But AppleScript is Link to comment Share on other sites More sharing options...
rice.shawn Posted September 12, 2014 Share Posted September 12, 2014 Carlos, I think you're one of the only people who has convinced me that AppleScript is useful for more than one-liners. That being said, I still like late 90's grunge, which is awful. Carlos-Sz 1 Link to comment Share on other sites More sharing options...
vitor Posted September 13, 2014 Share Posted September 13, 2014 convinced me that AppleScript is useful for more than Well, to be fair, the argument isn’t that Applescript is useless, just that it’s a dreadful language. Link to comment Share on other sites More sharing options...
Tyilo Posted December 26, 2014 Share Posted December 26, 2014 Any updates on support for this? To make osascript use javascript you have to invoke it with "-l JavaScript" (The capitalization is important!). Example: echo 'console.log("test");' | osascript -l JavaScript Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now