From bc2549212113219833d88ce74ade7e2eb5f9e309 Mon Sep 17 00:00:00 2001 From: Daniel Bayley Date: Sat, 5 Aug 2017 19:26:44 +0100 Subject: [PATCH 1/2] osascript: add page Also referred to from the open page. --- pages/osx/osascript.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 pages/osx/osascript.md diff --git a/pages/osx/osascript.md b/pages/osx/osascript.md new file mode 100644 index 000000000..d6b0f23ca --- /dev/null +++ b/pages/osx/osascript.md @@ -0,0 +1,27 @@ +# osascript + +> Run AppleScript or JavaScript for Automation (JXA) from the command line. + +- Run an AppleScript command: + +`osascript -e '{{say "Hello world"}}'` + +- Run multiple AppleScript commands: + +`osascript -e '{{say "Hello"}}' -e '{{say "world"}}'` + +- Run an AppleScript file: + +`osascript {{path/to/apple.scpt}}` + +- Get the bundle identifier of an application (useful for `open -b`): + +`osascript -e 'id of app "{{Application}}"'` + +- Run a JavaScript command: + +`osascript -l JavaScript -e '{{console.log("Hello world");}}'` + +- Run a JavaScript file: + +`osascript -l JavaScript {{path/to/script.js}}` From ba2530f42534f3b164662cdec12c3a76bf7c2166 Mon Sep 17 00:00:00 2001 From: Daniel Bayley Date: Sat, 12 Aug 2017 17:34:54 +0100 Subject: [PATCH 2/2] Update run AppleScript example --- pages/osx/osascript.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/osx/osascript.md b/pages/osx/osascript.md index d6b0f23ca..3b7c829cc 100644 --- a/pages/osx/osascript.md +++ b/pages/osx/osascript.md @@ -12,7 +12,7 @@ - Run an AppleScript file: -`osascript {{path/to/apple.scpt}}` +`osascript {{path/to/apple}}.scpt` - Get the bundle identifier of an application (useful for `open -b`):