Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
AppleScript
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Types and objects=== A script can define custom data types, or use one of the many built-in classes and objects which are provided by the language and tend to be recognized by scriptable applications. Notable built-in types and objects include: ; Basic objects * '''application''': used mostly as a specifier for tell statements (<code>tell application "Finder" …</code>) * '''script''': script objects are containers for scripts; every AppleScript creates a script object when run, and script objects may be created within AppleScripts * '''class''': meta-object that specifies the type of other objects * '''reference''': object that encapsulates an unevaluated object specifier that may or may not point to a valid object; can be evaluated on-demand by accessing its <code>contents</code> property ; Standard data objects * '''constant''': [[Constant (computer programming)|constant]] value; language-defined constants include <code>pi</code>, <code>tab</code> and <code>linefeed</code> * '''boolean''': [[Boolean data type|Boolean]] (true/false) value; [[Subclass (computer science)|subclass]] of <code>constant</code> * '''number''': [[Abstract type|abstract]] [[Superclass (computer science)|superclass]] of <code>integer</code> and <code>real</code>; rarely used directly * '''integer''': [[Integer (computer science)|integer]]; can be manipulated with built-in mathematical operators * '''real''': [[floating-point]] ([[Real number|real]]) number; can be manipulated with built-in mathematical operators * '''date''': date and time * '''text''': before AppleScript 2.0 (Mac OS X 10.4 and below) the <code>text</code> class was distinct from <code>string</code> and <code>Unicode text</code>, and the three behaved somewhat differently; in 2.0 (10.5) and later, they are all synonyms and all text is handled as [[UTF-16]]<ref name="as-rn-leopard">{{cite web |url=https://developer.apple.com/mac/library/releasenotes/AppleScript/RN-AppleScript/RN-10_5/RN-10_5.html |title=AppleScript Release Notes: 10.5 Changes |website=developer.apple.com |access-date=May 8, 2017}}</ref> ; Containers * '''list''': ordered list of objects; can contain any class, including other lists and classes defined by applications * '''record''': keyed list of objects; like a list, except structured as [[key–value pair]]s; runtime keyed access is unsupported; all keys must be compile-time constant identifiers ; File system * '''alias''': reference to an existing file system object (file or folder); maintains link to file system object if moved or renamed * '''file''': reference to a file system object; can can refer to an object that does not exist * '''POSIX file''': reference to a file system object, in plain text, using Unix ([[POSIX]])-style slash (/) notation; not a true data type, as AppleScript automatically converts a POSIX file to an ordinary file<ref>{{cite web|title=POSIX file — Class Reference — AppleScript Language Guide|url=https://developer.apple.com/library/content/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_classes.html#//apple_ref/doc/uid/TP40000983-CH1g-SW15|website=developer.apple.com|access-date=January 8, 2018|language=en}}</ref> ; Miscellaneous * '''RGB color''': specifies an RGB triplet (in [[High color#16-bit high color|16-bit high color]] format), for use in commands and objects that work with colors * '''unit types''': converts between standard units; for instance, a value can be defined as <code>square yards</code>, then converted to <code>square feet</code> by casting between unit types using the <code>as</code> operator
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)