beautypg.com

Apple AppleScript Finder Guide User Manual

Page 42

background image

C H A P T E R 2

Finder Objects

30

Object Class Definitions

The Get statement in this script returns a list of references to the selected items.

The Repeat statement tests the Original Item property for each selected alias

file. If the property’s value is a valid reference, the If statement asks the Finder

to reveal the original item.
For an example of a script application that performs a similar task, see the

definition of the Reveal command on page 131. For examples of scripts that

create alias files, see the definition of the Make command beginning on

page 121.

NOTES

A reference to an object of class Alias File in a Tell statement addressed to the

Finder is different from an AppleScript reference that uses an alias. You can use

an AppleScript alias reference like this anywhere in a script to identify a file:

alias "

Disk:Folder1:Folder2:...:Filename"

When you compile the script (for example, by clicking the Check Syntax button

in the Script Editor), AppleScript creates an alias record that identifies the file

even after you move the file from its original location—as long as you don’t

recompile the script.
Like an alias record, an alias file identifies another file or folder even after the

original has been moved. However, a reference to an alias file is just like any

other Finder reference: it must provide a complete description of the alias file’s

location in a form similar to this:

tell application "Finder"

alias file "

Filename" [ of container "ContainerX" ]... ¬

of container "

Container1" [ of disk "Disk" ]

end tell

If you move the alias file, the reference won’t be accurate any longer. Also, if

you attempt to use a Finder reference to an alias file outside of a Tell statement

addressed to the Finder, the script won’t run.