5. Keyword Conversion
Keyword conversion
Because application terminology resources specify AppleScript-style keywords for class, property, command, etc. names, appscript uses the following rules to translate these keywords to legal Ruby identifiers:
- Characters a-z, A-Z, 0-9 and underscores (_) are preserved.
- Spaces, hyphens (-) and forward slashes (/) are replaced with underscores.
- Ampersands (&) are replaced by the word 'and'.
- All other characters are converted to 0x00-style hexadecimal representations.
- Names that begin with '_' or 'AS_' have an underscore appended.
- Names that match the methods already defined on appscript's Application and Reference classes have an underscore appended. The reserved method names are:
abort_transaction ignore after inspect and instance_eval any instance_variable_get before instance_variable_set begin_transaction instance_variables beginning is_in begins_with is_not_in by_aem_app keywords by_creator last by_id launch by_name le by_pid lt by_url method class method_missing clone methods commands middle contains ne current next display not does_not_begin_with object_id does_not_contain or does_not_end_with parameters dup previous elements private_methods end properties end_transaction protected_methods ends_with public_methods eq result_type extend send first singleton_methods freeze taint ge timeout gt to_a hash to_s help type ID untaint id wait_reply
- Appscript provides default terminology for standard type classes such as
integer
andunicode_text
, and standard commands such asopen
andquit
. If an application-defined name matches a built-in name but has a different Apple event code, appscript will append an underscore to the application-defined name.
You can use ASDictionary or appscript's built-in help
method to export or view application terminology in appscript format. See the Getting Help chapter for more information.