beautypg.com

Apple AppleScript Finder Guide User Manual

Page 33

background image

C H A P T E R 2

Finder Objects

The Finder Application Object

21

working area of your screen and not contained by a folder, disk, or other

object—can be considered elements of either the desktop or of the Finder

application object, as shown in the following examples.
This script requests a list of the items contained by the desktop:

tell application "Finder"

items of desktop

end tell

--result: {trash of application "Finder", disk
"Applications" of application "Finder", disk "Storage" of
application "Finder", startup disk of application "Finder"}

If you request the items of the Finder application, you get a similar list:

tell application "Finder"

items

end tell

--result: {trash of application "Finder", disk
"Applications" of application "Finder", disk "Storage" of
application "Finder", startup disk of application "Finder",
desktop of application "Finder"}

The only difference is that the second list includes a reference to the desktop

itself, which is also an item contained by the Finder application.
Finally, if you request the contents of the Finder application, you get a list that

includes references to windows and to currently running processes as well as

to the Finder’s items:

tell application "Finder"

contents

end tell

--result: {trash of application "Finder", disk
"Applications" of application "Finder", disk "Storage" of
application "Finder", startup disk of application "Finder",