Forrest logo
tool overview
On this page you find all important commands for the CLI tool osascript. If the command you are looking for is missing please ask our AI.

osascript

The "osascript" command-line tool is a powerful tool available in macOS that allows users to execute AppleScripts and access various scripting languages. It stands for "Operating System Scripting Addition Compiler".

  1. Developed by Apple, "osascript" enables users to run AppleScripts from the command line.
  2. It supports multiple scripting languages such as AppleScript, JavaScript, Perl, and Ruby.
  3. By leveraging "osascript," users can automate tasks on a Mac using AppleScript or run other supported script languages for different purposes.
  4. The tool provides a convenient way to interact with macOS system events, applications, and various services programmatically.
  5. It can be used for a plethora of tasks like automating repetitive tasks, performing UI scripting, controlling applications, and manipulating files.
  6. "osascript" allows users to pass arguments and input parameters to the executed scripts, enabling dynamic script behavior.
  7. It is particularly useful for system administrators, developers, and power users who need to automate and control macOS features and applications through scripting.

List of commands for osascript:

  • osascript:tldr:50d46 osascript: Run multiple AppleScript commands.
    $ osascript -e "${say 'Hello'}" -e "${say 'world'}"
    try on your machine
    explain this command
  • osascript:tldr:80eb4 osascript: Run a JavaScript file.
    $ osascript -l JavaScript ${path-to-script-js}
    try on your machine
    explain this command
  • osascript:tldr:a7161 osascript: Run an AppleScript command.
    $ osascript -e "${say 'Hello world'}"
    try on your machine
    explain this command
  • osascript:tldr:e480d osascript: Run a compiled (`*.scpt`), bundled (`*.scptd`), or plaintext (`*.applescript`) AppleScript file.
    $ osascript ${path-to-apple-scpt}
    try on your machine
    explain this command
  • osascript:tldr:e7854 osascript: Get the bundle identifier of an application (useful for `open -b`).
    $ osascript -e 'id of app "${Application}"'
    try on your machine
    explain this command
  • osascript:tldr:f2004 osascript: Run a JavaScript command.
    $ osascript -l JavaScript -e "${console-log('Hello world');}"
    try on your machine
    explain this command
tool overview