Online Book Reader

Home Category

AppleScript_ The Definitive Guide - Matt Neuburg [148]

By Root 1506 0
42 in a store script command, the script will compile and run. If you try to set a date's weekday to yes, the script will compile but not run.

Applications are free to extend AppleScript's vocabulary by implementing constants of their own. For example, GraphicConverter can save an image file in many formats, and it needs a way to let you specify a format; it does this with some four dozen constants, such as PICT, TIFF, GIF, BMP, and JPEG. An application's dictionary will show you the constants that can be used in any connection with a given command. See "Enumerations" in Chapter 20.

Name

true, false

Description

Boolean values. See "Boolean" in Chapter 13 and "Boolean Operators" in Chapter 15.

Example

open for access f write permission true

Name

yes, no, ask

Description

Options when saving a file. For a description of some typical behavior in response to these options, see "Compiled Script Files as Script Objects" in Chapter 8.

Example

store script s in f replacing yes

Name

missing value

Description

This is actually a class, but it has no values; all you'll ever see is the class itself, so it works as if it were a constant. It seems to be a way for an application to return a value while signaling a nonvalue; it isn't an error, and it isn't a failure to return any value at all.

Example

tell application "Finder" to get description of folder 1 -- missing value

Name

null

Description

Like missing value, this is implemented as a class with no values. I've never found a use for it in communicating with a scriptable application, nor have I ever seen an application return it as a result. But I do sometimes use it in my own scripts, as a way of giving a variable or record item a value that signifies "No value has been assigned yet" without its being undefined. Examples have appeared in "The Run Handler" in Chapter 9 and "Record" in Chapter 13.

Example

set aPerson to {name:null, age:null, town:null}

Name

plain, bold, italic, outline, shadow, underline, superscript, subscript, strikethrough, small caps, all caps, all lowercase, condensed, expanded, hidden

Description

Text styles, for applications that wish to speak of such things. The example here shows Tex-Edit Plus returning a text style record. (See "Records" in Chapter 20.) This is a record consisting of two lists, the on styles (those that are applied to a piece of text) and the off styles (those that are not applied to a piece of text). The items of each list are text styles. The piece of text we're asking about here is underlined.

Example

tell application "Tex-Edit Plus"

set tsr to style of word 4 of document 1

on styles of tsr -- {underline}

end tell

Name

case, diacriticals, white space, hyphens, expansion, punctuation, numeric strings

Description

String considerations ; see "Considering/Ignoring" in Chapter 19.

Example

considering case

"heyho" contains "H" -- false

end considering

Name

application responses

Description

See "Considering/Ignoring" in Chapter 19.

Example

ignoring application responses

tell application "GraphicConverter" to quit

end ignoring

Name

current application

Description

The top-level object. See "The Implicit Parent Chain" in Chapter 8.

Example

name of

current application -- Script Editor

Name

Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday

Description

Days of the week; see "Date Properties" in Chapter 13. These terms are actually implemented as class names (I don't know why).

Example

weekday of (current date) -- Wednesday

Name

January, February, March, April, May, June, July, August, September, October, November, December

Description

Names of months; see "Date Properties" in Chapter 13. These terms are actually implemented as class names (I don't know why).

Example

month of (current date) -- May

Chapter 18. Commands


A command is basically a verb. Technically, a command is called an event (because it really is an Apple event, as discussed in Chapter

Return Main Page Previous Page Next Page

®Online Book Reader