Chapter 16. Global Properties
This
chapter catalogues the global script properties of the AppleScript
language. These are implemented by the AppleScript scripting
component, which is present as the parent of the top-level script
(see Section 9.7.3). They are globally accessible, as
if your entire script started with property declarations for them. In
case of a naming conflict, they can also be accessed like the
properties of any visible script object, using the term
AppleScript
as the script
object’s name. For example:
property pi : 3
display dialog AppleScript's pi -- 3.141592...
These are script properties like any other script properties, and as such:
They are settable.
Their values are in common to all scripts running under this instance of the AppleScript scripting component.
They persist for as long as this instance of the AppleScript scripting component persists.
The status of the global script properties is thus somewhat
counterintuitive. You can accidentally (or intentionally) change
their values, and then scripts that rely upon them to have their
default values will not work. You would probably have expected things
like pi
and tab
to remain
constant. That’s not the case—you can change
their values—and furthermore if you change such a value in one
script in a script editor application, the new value affects all
scripts run in that script editor application, until you quit the
application.
Strings
Get AppleScript: The Definitive Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.