2016

Table Of Contents
IMPORT THE FIRST PICTURE
tell picture box 1
set rotation to -25
try
set image 1 to alias (thepath & "Shirts.TIFF")
on error
set image 1 to (choose le with prompt "Please select the le
\'Shirts.TIFF\'." of type {"TIFF"})
end try
tell image 1
set scale to {115, 115}
end tell
end tell
end tell
CONCEPTS
The statements above are similar to locating and importing an image file in
the Get Picture dialog box (File menu).
The
with
statement references the first picture box by index [1].
The first
set
event specifies the rotation property of the picture box.
The
try
statement looks for the “Shirts.tiff”le in the location previously
defined by
thepath
. If the file exists in this location, the
set
event specifies
“Shirts.tiff” as the image in the picture box. (A picture box can only have
one image.)
If “Shirts.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,
“Open the image named ‘Shirts.tiff.’” Once the user locates the image file and
clicks OK, the set event imports the image.
The second
tell
statement references the image by index [1].
CREATE THE SECOND PICTURE BOX AND IMPORT A PICTURE
tell page 1 of layout space 1 of project 1
make picture box at end with properties
{bounds:{"8.471 cm", "2 cm", "9.971 cm", "3.5 cm"}, color:"None"}
tell picture box 2
try
SCRIPT WRITING SAMPLE
A GUIDE TO APPLE EVENTS SCRIPTING
|
27