mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-08-04 07:15:32 +02:00
osascript: add page (#1440)
This commit is contained in:
commit
92b64fef19
1 changed files with 27 additions and 0 deletions
27
pages/osx/osascript.md
Normal file
27
pages/osx/osascript.md
Normal file
|
@ -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}}`
|
Loading…
Add table
Reference in a new issue