Apple AppleScript Finder Guide User Manual Page 28

  • Download
  • Add to my manuals
  • Print
  • Page
    / 168
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 27
CHAPTER 2
Finder Objects
16 Using Object Class Denitions
tell application "Finder"
set position of file "MyFile" to {29, 235}
end tell
The file in this example must be located on the desktop. A file can have only
one Position property, distinguished from the other properties of the file by its
label, position.
The Properties section of an object class definition lists all the property labels
defined for that object and describes how to use them, including the class used
for each property’s value and whether or not the property can be modified.
Some objects inherit some or all their properties from other related objects. For
example, the definition for File that begins on page 61 lists several properties
that are inherited from the object class Item and several that are defined
specifically for class File.
IMPORTANT
A property name has no plural form, even if you use it to
refer to more than one property.
This script gets a list of the names of the files at the top level of the startup disk:
tell application "Finder"
name of files in startup disk
end tell
If you replace name with names, the script won’t compile.
Element Classes 2
Elements are objects contained by an object. For example, a folder can contain
files and other folders. The element classes listed in an object class definition
show what kinds of elements objects of that class can contain. An object can
contain many elements or none, and the number of elements of a particular
class may change over time.
A file can be an element of other Finder objects in which files can be stored,
such as folders, disks, or the desktop; so File is listed as one of their element
classes. The definition for object class File that begins on page 61 indicates that
a file can’t contain any other elements.
Page view 27
1 ... 27 28 29 ... 168

Comments to this Manuals

No comments