beautypg.com

Apple AppleScript Finder Guide User Manual

Page 48

background image

C H A P T E R 2

Finder Objects

36

Object Class Definitions

This statement identifies a folder:

folder ID 918 of startup disk
-—result: folder "My Folder" of startup disk of application
"Finder"

This statement identifies the TeachText application:

application file id "ttxt"
-—result: file "TeachText 7.1" of startup disk of
application "Finder"

You can identify the frontmost window that lies under a particular point on the

desktop by running a script like this:

tell application "Finder"

content space {100,100}

end tell

--result: window of folder "Projects" of startup disk of
application "Finder"

The pair of integers in braces in the preceding example identifies the point

in which you’re interested, and the result contains a reference to the window

that contains that point. It is usually easiest to use the term Content Space

to obtain this kind of reference, because the script returns a reference even

if the point is located on the desktop or in some specialized window such as

an Information Window.
You can also specify more restricted window classes, such as Window,

Container Window, Information Window, and so on. For example, if

you request a reference to a container window for a point that’s located

in some other kind of window, the Finder returns an error.

COMMANDS HANDLED

Clean Up, Computer, Count, Data Size, Exists, Get, Print, Quit, Restart, Select,

Shut Down, Sleep, Sort