Live data from Hacker News

JavaScript as an alternative to AppleScript on OS X Yosemite

developer.apple.com

11–20 of 126 posts

Re: JavaScript as an alternative to AppleScript on OS X Yosemite

#12
I love AppleScript because whenever somebody asks, "Why don't they make programming languages more like English?" all you need to do is show them AppleScript.

The functionality exposed by OSX apps via AppleScript is often incredible, but the language itself is annoying.

The question is whether or not applications will support it. With the emphasis shifting away from OSX desktop applications to cross-platform and cloud apps, will OSX app developers still take the time to expose scripting functionality?

Re: JavaScript as an alternative to AppleScript on OS X Yosemite

#14
post #5

AppleScript contains some amazingly powerful APIs, but is nearly impossible to write. Having a Javascript (successor?) implementation is going to unleash its full potential. I could see it becoming much more widely used and supported by third party apps. This is wonderful. In the same cycle that they release a brand new language, they begin the deprecation process for their (only?) other proprietary programming langu…

As braindead as the language was, the real problem with AppleScript was the bizarre object model, so the Object help doc was full of nonsense methods that did nothing useful. Finding the one method doExactlyOneSpecificThing that matched what you need was always a low-probability event. The opposite of the UNIX philosophy and modular design.

Re: JavaScript as an alternative to AppleScript on OS X Yosemite

#16
post #10

Earlier quoted context omitted.

$ = Application; Easy fix!

Not if you want to use the Obj-C bridge, though :) "The primary access points for the Objective-C bridge are the global properties ObjC and $."

Bridge = $;

$ = Application;

Re: JavaScript as an alternative to AppleScript on OS X Yosemite

#17
post #11

Haven't wrapped my brain completely around this yet, but I wonder if it's going to allow for some cool (and/or dangerous?) crossover write-once-run-in-browser-or-locally apps.

I don't think that's the case. AppleScript is the equivalent of shell scripting for GUI appls.

You don't write applications in AppleScript; you use AppleScript to control other applications in an automated way.

You can write AppleScripts with simple dialog boxes and such, just as you can write interactive bash scripts. And while you could theoretically implement an application entirely as a shell script or batch file or AppleScript, it'd be a bit like mowing your lawn with a pair of scissors.

Re: JavaScript as an alternative to AppleScript on OS X Yosemite

#19
post #3

This makes me really happy. I kind've wish they'd used $ for what Application() is, though, to keep an analogous similarity with jQuery and the like.

Could there be any reasonable situation where one might want to load jQuery within this environment, though?

(Although, I suppose, you could use another var for jQuery, such as, uh, 'jQuery' ...)

Post reply on HN