Name
Finder Commands
Synopsis
The following commands can be used by enclosing them in a
tell
statement that targets the Finder, as in:
tell app "Finder" to sleep
Dictionary commands
-
add to favorites
reference
The Apple Menu in the upper left corner of the Mac OS 9 screen has a Favorites menu item that includes folders and programs that are displayed or executed if you select them. You can use this command to add to the Favorites list:
tell application "Finder" to add to favorites (folder "today" of desktop)
This adds a folder called today on the desktop to the Favorites menu.
-
clean up
reference
This command neatly arranges buttons or icons in an open window or on the desktop:
tell application "Finder" to clean up window "HFSA2gig"
(See the Finder’s View menu, which determines how Finder items like folders are aligned on the desktop.) If you use
clean up all
, this command has the same effect as clean up desktop by name.-
by property
This labeled parameter determines how items are arranged; e.g., by comment, modification date, name, size, or version. An example is:
clean up desktop by name
This Finder command arranges the desktop items by their name in alphabetical order.
-
-
close
reference
Use the close command followed by a reference to one or more windows. An example is:
tell application "Finder" to close window "HFSA2gig"
You can also close multiple objects:
tell app "Finder" to close every window
This command closes every Finder window on the desktop, such as folder or disk windows.
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.