Something went wrong. Try again.
AppleScript grammar for tree-sitter
applescript tree-sitter-grammar tree-sitter
Something went wrong. Try again.
7.2 kB · 249 lines
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250================================================================================Close command with saving parameter================================================================================
tell application "TextEdit" close every document with savingend tell
--------------------------------------------------------------------------------
(source_file (tell_statement target: (application_expression name: (string)) (application_command command: (identifier) (command_argument (identifier)) (command_argument (identifier)) (with_clause option: (property_name (identifier))))))
================================================================================Close command without saving parameter================================================================================
tell application "TextEdit" close every document without savingend tell
--------------------------------------------------------------------------------
(source_file (tell_statement target: (application_expression name: (string)) (application_command command: (identifier) (command_argument (identifier)) (command_argument (identifier)) (without_clause option: (property_name (identifier))))))
================================================================================Save with multiple labeled parameters================================================================================
tell application "Script Debugger" tell front document save in theFile as text script line endings Unix endings end tellend tell
--------------------------------------------------------------------------------
(source_file (tell_statement target: (application_expression name: (string)) (tell_statement target: (property_name (front_document)) (application_command command: (identifier) (labeled_parameter label: (identifier) parameter: (identifier)) (labeled_parameter label: (identifier) parameter: (identifier)) (labeled_parameter label: (identifier) parameter: (identifier)) (labeled_parameter label: (identifier) parameter: (identifier))))))
================================================================================Click at location================================================================================
tell application "System Events" click at {100, 200}end tell
--------------------------------------------------------------------------------
(source_file (tell_statement target: (application_expression name: (string)) (application_command command: (identifier) (command_argument (identifier)) (command_argument (list (number (integer)) (number (integer)))))))
================================================================================Choose file with prompt================================================================================
set theFile to choose file with prompt "Select a file"
--------------------------------------------------------------------------------
(source_file (set_statement target: (identifier) value: (application_command command: (identifier) (direct_parameter parameter: (identifier)) (with_clause option: (property_name (identifier)) value: (string)))))
================================================================================Choose file name with default name================================================================================
set thePath to choose file name with prompt "Enter name" default name "Untitled.txt"
--------------------------------------------------------------------------------
(source_file (set_statement target: (identifier) value: (application_command command: (identifier) (direct_parameter parameter: (identifier)) (with_clause option: (property_name (identifier)) value: (string)) (labeled_parameter label: (identifier) parameter: (identifier)) (labeled_parameter label: (identifier) parameter: (string)))))
================================================================================Save as with line endings================================================================================
tell application "Script Debugger" tell front document save as text script line endings Unix endings end tellend tell
--------------------------------------------------------------------------------
(source_file (tell_statement target: (application_expression name: (string)) (tell_statement target: (property_name (front_document)) (application_command command: (identifier) (labeled_parameter label: (identifier) parameter: (identifier)) (labeled_parameter label: (identifier) parameter: (identifier)) (labeled_parameter label: (identifier) parameter: (identifier))))))
================================================================================Open location command================================================================================
tell application "Safari" open location "https://example.com"end tell
--------------------------------------------------------------------------------
(source_file (tell_statement target: (application_expression name: (string)) (application_command command: (identifier) (direct_parameter parameter: (identifier)) (direct_parameter parameter: (string)))))
================================================================================Keystroke with using modifiers================================================================================
tell application "System Events" keystroke "c" using {command down}end tell
--------------------------------------------------------------------------------
(source_file (tell_statement target: (application_expression name: (string)) (application_command command: (identifier) (command_argument (string)) (using_clause modifiers: (list (property_name (identifier) (identifier)))))))
================================================================================Command with given clause================================================================================
calculateArea given width:5, height:3
--------------------------------------------------------------------------------
(source_file (application_command command: (identifier) (given_clause (labeled_parameter label: (identifier) parameter: (number (integer))) (labeled_parameter label: (identifier) parameter: (number (integer))))))