Team LiB   Previous Section   Next Section
id

Syntax

set fileID to id of file "mydocument"

Description

Disks, folders, and files, when accessed through the Finder, have a unique id property, even if you change the name of the item. The id is an integer such as 297774 (disks often have negative numbers for ids, such as -1). You can only use the id reference style with objects that have an id property. This property is identified in their dictionary (Chapter 2, discusses dictionaries). The following example code shows how to use the id reference.

Examples

tell application "Finder"

   set tid to id of folder "today" -- returns an integer such as 277000

   set name of folder "today" to "yesterday" (* changes name of original 

folder *)

   open (the first folder whose id is tid) (* still opens original folder using

its id property *)

end tell
    Team LiB   Previous Section   Next Section