Live data from Hacker News

JavaScript as an alternative to AppleScript on OS X Yosemite

developer.apple.com

81–90 of 126 posts

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

#82
post #68
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…

AppleScript was originally conceived to be easy enough for non-professional programmers to read and write, with the history of Hypercard behind it. This is for those rare occasions when they needed to automate something that they do with multiple applications manually. At one point, you were able to hit "Record", do the things that you needed to be automated and boom you get a script that you can begin to massage int…

That reminds me... the first "web app" I ever built was a home automation interface, hacked together with AppleScripts, because that's all I could figure out how to do on my Mac in high school (circa 2001). I don't remember how the webserver portion of it worked (but I definitely didn't implement it myself)

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

#83
post #68

Earlier quoted context omitted.

AppleScript was originally conceived to be easy enough for non-professional programmers to read and write, with the history of Hypercard behind it. This is for those rare occasions when they needed to automate something that they do with multiple applications manually. At one point, you were able to hit "Record", do the things that you needed to be automated and boom you get a script that you can begin to massage int…

That reminds me... the first "web app" I ever built was a home automation interface, hacked together with AppleScripts, because that's all I could figure out how to do on my Mac in high school (circa 2001). I don't remember how the webserver portion of it worked (but I definitely didn't implement it myself)

I was trying to remember that as well, but I think I now do - it's the "Internet suite", which has a CGI handler implementation.

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

#84
post #68

Earlier quoted context omitted.

AppleScript was originally conceived to be easy enough for non-professional programmers to read and write, with the history of Hypercard behind it. This is for those rare occasions when they needed to automate something that they do with multiple applications manually. At one point, you were able to hit "Record", do the things that you needed to be automated and boom you get a script that you can begin to massage int…

Automator even has the same "record" functionality for repeating tasks in a UI[1]. The direct Automator actions like "scale image" are cleaner when they exist, but including Automator actions with 3rd party applications didn't catch on as much as it could have. Some apps have them (Pixelmator comes to mind), but for the most part it doesn't have the support that AppleScript used to. It's a bit sad that we now have ea…

The core of AppleScript is a protocol defined as the OSA. This, as Camillo pointed out, is super close to REST and that suggests a possible evolution of the underlying idea as a glue system between "web apps" including desktop apps.

Actually, even an 'evolution' isn't necessary, since AppleScript can directly work with Objective-C frameworks, instantiating objects, calling methods, etc. So this gluing between the desktop world and the networked world already exists.

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

#85
post #23

If anyone wants to do stuff similar to this on earlier versions of OS X (but arguably even more generally) or on iOS they should look at one of my projects, Cycript, an Objective-C/JavaScript hybrid with a highly-bridged Foundation/JavaScriptCore object model that can inject code into running applications. http://www.cycript.org/ (I expect to have the ability to introspect and manipulate Swift objects in the near fut…

> earlier versions of OS X

Will Cycript work on 10.10 or are you just saying that you'll have two JS choices now (Cycript and JS Automation)?

I use Substrate all the time, I really need to look into Cycript! =)

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

#86
so, I'm a little confused here - more than a year ago, the Gnome Project picked Javascript as its primary dev language and it was linked here on HN (https://news.ycombinator.com/item?id=5169599)

That entire thread is around how Javascript is a bad paradigm for desktop. But, this entire thread is how amazing javascript is going to be for OSX.

Let me add that the JS programming model of Gnome is what powers http://extensions.gnome.org - and I have my own extensions in there. Also (and correct me if I'm wrong) the "GObject Introspection" mechanism is fairly analogous to OSA.

So, is there a underlying technical or implementation issue that makes it good on OSX and bad on Gnome ? use case? technology ? OSA ?

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

#87
post #23

If anyone wants to do stuff similar to this on earlier versions of OS X (but arguably even more generally) or on iOS they should look at one of my projects, Cycript, an Objective-C/JavaScript hybrid with a highly-bridged Foundation/JavaScriptCore object model that can inject code into running applications. http://www.cycript.org/ (I expect to have the ability to introspect and manipulate Swift objects in the near fut…

> earlier versions of OS X Will Cycript work on 10.10 or are you just saying that you'll have two JS choices now (Cycript and JS Automation)? I use Substrate all the time, I really need to look into Cycript! =)

The Apple thing only works on 10.10 (which most people reading this wouldn't be using currently), so I am saying that there is an option for earlier systems. Cycript actually doesn't work on 10.10 right now (well, it does, but it is frustrating to use as you have to keep saying this. before global variavles) due to a change made in JacaScriptCore that I am unhappy with (talked to some people at Apple, filed a bug with WebMit, and am checking with a friend of mine on the ECMAScript committee), but I have a reasonable workaround I can use for non-Cydget use and for Cydget crazy one-off Substrate hacks are fair game, so I should have everything fixed soon for a new release.

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

#89
Oh Javascript. This has been said so many times before, but why, oh why, has the world converged on this particular language?

Why aren't there saner alternatives to Javascript in browsers? We have so many languages at our disposal, why choose Javascript? Why don't people realize that web programming is not great because of Javascript but despite Javascript?

We are bound to Javascript on the web because browsers, for whatever reason, don't support anything else. But we don't have to make matters worse by dragging this weirdo language unto the rest of the programming world.

But who am I kidding, AppleScript may be one of the few languages actually worse than Javascript.

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

#90
post #21

Stupid and uninformed question here: Given Apple's well-known antipathy to the idea of browser engines other than WebKit and scripting languages other than JavaScript on iOS (yes, yes, I know you can find Python/Lua/Lisp/whatever apps on iOS; I mean as a general rule and for inter-app automation), could this be a prelude to allowing some sort of sandboxed-app automation interface on iOS? That is, allow a JavaScript i…

Genuine answer here. There's no need to apologize for not constantly immersing yourself in the workings of Apple platforms. :-) JavaScript is just another interface to Apple's "Open Scripting Architecture (OSA)." Previously, AppleScript was the only way to use it. The fact that they added another language indicates nothing about whether OSA will ever come to iOS. My guess is it won't; the new extensions APIs will lik…

There are other language interfaces to OSA. Frontier's UserTalk was an early implementation (and much more useful than AppleScript IMO) IIRC, there are also Python and Ruby bindings as well.
Post reply on HN