Live data from Hacker News

JavaScript as an alternative to AppleScript on OS X Yosemite

developer.apple.com

21–30 of 126 posts

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

#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 implementation running on iOS to "drive" apps via this object model?

(Genuine question here. I have no idea whether I'm blowing smoke or whether this is a plausible long-term direction for Apple to take iOS.)

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

#22
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…

While never particularly popular, both Apple (AppleScript Studio and subsequent AppleScript Xcode templates) and third parties (FaceSpan) have provided full IDEs for developing applications with AppleScript.

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

#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 future as well, and have a talk on preliminary research of low-level Swift object runtime metadata at #AltConf a couple days ago. The console will also support some of Swift's syntax, such as the named-argument-style method calls.)

https://www.youtube.com/watch?v=Ii-02vhsdVk

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

#25
post #4
post #2

It would be cool if they also add some kind of support for swift (or some variant) too.

plot twist: a Swift-to-JS compiler

will be a very simple step since swift is a llvm frontend and we already have this great tool: https://github.com/kripken/emscripten

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

#26
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…

I'm not sure if this answers your question, but you've been able to execute native javascript in your apps since iOS 7: https://developer.apple.com/library/mac/documentation/Carbon...

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

#27
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 likely handle any inter-app communication Apple wants to allow, because they are designed with iOS's sandbox model in mind already.

Put another way, Javascript is to AppleScript with respect to OS X automation, as Scala is to Java on the JVM. The existence of Scala does not indicate that the JVM will be ported to the Haiku OS. (There may be a better analogy but that's what I came up with.)

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

#29
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…

For developers, I think you can write ui automation tests in javascript for your own app during debugging/testing.

In the general case, for published apps, I'm not seeing it happen. Apple seems to be super focused on sandboxing and separating components on iOS. Even with the new iOS8 extensions, everything needs to be user triggered and even then, extensions live on separate islands.

It's doubtful they'll change that model since it would defeat the "you can't break your idevice even if you tried" feeling for end users and the app store.

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

#30
"Because JavaScript is the language of the web browser, and because the web browser has become the dominant application delivery system, and because JavaScript isn't too bad, JavaScript has become the World's Most Popular Programming Language. Its popularity is growing. It is now being embedded in other applications and contexts. JavaScript has become important.

It is better to be lucky than smart."

- Douglas Crockford, 2008

Post reply on HN