2

The terminal command osalang list the following installed OSA languages supported by osascript.

AppleScript
JavaScript
Generic Scripting System

Using AppleScript or JavaScript works. For example:

osascript -l JavaScript \
    -e 'Application("iTunes").currentTrack.name()'

However, something like to following returns a "found unknown token" error.

osascript -l 'Generic Scripting System' \
    -e '#!/bin/bash' \
    -e 'echo $HOME'

How does one invoke osascript for 'Generic Scripting System' from the command line for some non-AppleScript, non-JavaScript scripting ... without using any (intermediate) AppleScript or JavaScript? Is this even possible?

2

According to OS X system internals, the "Generic Scripting System" is a generic class to contain the two flavors of scripting supported:

  • AppleScript
  • JavaScript

It's not some third option that adds one or more new dialects, but a container to hold the existing ones. This is indirectly explained in Apple's documentation - they list the two languages and don't mention the wrapper class (or whatever it's proper name is):

If you needed other languages, I would call AppleScript "do shell script..." to then call whatever shell executable that ships by Apple or you have installed (bash, sh, python, swift, perl, ...).

  • 1
    so, apparently, the "Generic Scripting System" listed by osalang is not some gateway beyond the available AppleScript & JavaScript. After your answer, i thought to check the Activity Monitor (information button, Open Files and Ports) with the interactive session osascript -l 'Generic Scripting System' -i. ... the "Generic" interactive goes right to the AppleScript framework resources. – l --marc l Apr 28 '17 at 0:46

You must log in to answer this question.

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