Working with Files, Folders, Disks, and Windows in OS X

As in OS 9, a file, folder, and disk (but not a window) are item objects in Mac OS X. The code in Example 32-1 returns a list of all the files and folders that are in the current logged-in user’s Desktop folder. Unlike OS 9, OS X only displays the contents of the Desktop folder of the currently logged-in user. OS 9’s displayed desktop unifies all of the desktop folders of the startup disk and any other local volumes that contain a System Folder. For example, in OS 9, if you have two bootable volumes—“MacDiskA” and “MacDiskB”—then the desktop items that you see represent any file or folder that was created in or moved to the desktop, regardless of which disk has been the startup disk.

By contrast, the Mac OS X Finder only displays (on the computer desktop) the contents of the current logged-in user’s Desktop folder. Everything else is an icon sitting on the Dock or viewed through a Finder window. For example, if I log in as “brucep,” then my desktop folder is located in the following directory: startup disk:users:brucep:library:desktop (or, as this folder path would be depicted by the Unix-based Darwin sub-system, /users/brucep/library/desktop). So if I have a file in my desktop folder at this directory location called newfile.txt, this file is displayed on the OS X desktop only when I am logged in. If a user with a login name of “brynne” logs in to the computer, then the OS X Finder will only display the contents of Brynne’s ...

Get AppleScript in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.