Support for javascript automations started with Yosemite.

How could I run using javascript an external command? (i.e. the equivalent of do shell script of applescript?


If you look in the StandardAdditions.sdef.

  1. Menubar menu: Windows -> Library
  2. Double click on: StandardAdditions
  3. Change the dropdown to Javascript.

You will see that many of the script command change to the camelHump syntax

enter image description here

app = Application.currentApplication()
app.includeStandardAdditions = true;


enter image description here

  • The example you give is a plain OS X executable - ls – user151019 Jan 20 '15 at 18:47
  • @Mark It is a do shell script to an external command i.e shell command not part of applescript. you can point it at any external command in the same way you can with Applescript Do shell script This is exactly what was asked for.. so what have I missed?. – markhunte Jan 20 '15 at 18:56
  • It is to run a javascript method etc - I should have marked this one as the duplicate – user151019 Jan 20 '15 at 18:58
  • @Mark, No it is not to run a javascript per-say. The OP wants to run a do shell script but using Javascript for Automation. As shown in my example. Do shell script are Run in Script editor which now runs Javascript or Applescript. – markhunte Jan 20 '15 at 19:02
  • 2
    @kenorb thanks for the edit. it was only introduced in 10.10 – markhunte Aug 17 '15 at 9:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .