====== AppleScript ====== ===== Cheatsheet ===== * Get actual path of finder window if opened #!/usr/bin/env bash if ! osascript -s o < * Display an hello world window osascript -e 'tell application "Finder" activate display dialog "Hello, World!" end tell' * Display an hello world window but without sending events to another process osascript < The useful commands in the Standard Additions extension include: * user interaction: choose file/folder/from list, display dialog/alert/notification * file commands: mount volume * clipboard commands: get the clipboard, set the clipboard to * sound control: set volume, get volume settings * system info When your script uses only these commands, make sure they are not contained in tell blocks. This will avoid unnecessary prompts for access approval. ===== Exempt AppleScript commands ===== Some AppleScript commands are treated differently and will not trigger privacy approval: * activate: launch application and/or bring to front * open: open a file * open location: open a URL * quit: quit the application osascript <