1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-22 17:22:10 +02:00
tldr/pages/osx/osascript.md
bl-ue 8ebd171d6f
*: fix typos reported by Hunspell (#5848)
Co-authored-by: marchersimon <50295997+marchersimon@users.noreply.github.com>
Co-authored-by: Seth Falco <seth@falco.fun>
Co-authored-by: Patrice Denis <patricedenis@users.noreply.github.com>
2021-05-20 16:13:41 -04:00

27 lines
674 B
Markdown

# 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 a compiled (`*.scpt`), bundled (`*.scptd`), or plaintext (`*.applescript`) 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}}`