2016

Table Of Contents
set image 1 to alias (thepath & "Glove.TIFF")
on error
set image 1 to (choose le with prompt "Please select the le
\"Glove.TIFF\"." of type {"TIFF"})
end try
set bounds of image 1 to exact fit
end tell
CONCEPTS
The first seven lines above are similar to creating a picture box, sizing and
positioning it, and then specifying a background color as you would in the
Picture tab of the Modify dialog box. The last six statements are similar
to locating and importing an image file in the Get Picture dialog box.
The
tell
statement references the first page of the active layout; both are
referenced by index [1].
The
make
event makes a picture box using the specified properties.
The
tell
statement references the second picture box by index [2].
The
try
statement looks for the “Glove.tiff” file in the location previously
defined by
thepath
. If the file exists in this location, the
set
event specifies
“Glove.tiff” as the image in the second picture box.
If “Glove.tiff” does not exist in the location defined by
thepath
, the script will
continue with the
on error
statement. This statement handles error conditions
by providing another set of instructions if an error occurs.
The first string is a message to the user shown at the bottom of the dialog box,
“Please select the file ‘Glove.tiff.’” Once the user locates the image file and
clicks OK, the
set
event imports the image.
The last
set
event references the image by index [1]. The bounds property of
the image is set to exact fit.
CREATE AND POSITION COPIES OF THE PICTURE BOX
duplicate picture box 2 to after picture box 2
tell picture box 3
set bounds to {"12.471 cm", "2 cm", "13.971 cm", "3.5 cm"}
end tell
duplicate picture box 2 to after picture box 3
tell picture box 4
set bounds to {"16.471 cm", "2 cm", "17.971 cm", "3.5 cm"}
end tell
SCRIPT WRITING SAMPLE
28
|
A GUIDE TO APPLE EVENTS SCRIPTING