Verbs Used with Windows

In addition to properties, Finder windows respond to a specific set of verbs or commands. Some of these have been incorporated into our previous scripts:

get: used to access the current values of a window property
set: used to apply a new value to a window property
open: causes a window to display in the Finder
close: causes a window to close

With these commands we’ve been able to manipulate the size, position, and display of Finder windows. Now we’ll add another command for controlling windows to our vocabulary: select

Although the select verb can be applied to other scriptable objects, it can be used to make a window active so that it moves in front of any other open windows:

select: causes a window to come to the front

Delete the previous script from the script window, and then enter, compile, and the following script:

Click to open example in the Script Editor application
tell application "Finder" to select the last Finder window

The Finder window that was behind the front Finder window now moves to the front of the open windows.

NOTE: you could accomplish the same result by using the set verb to change the value of the index property of the last Finder window:

Click to open example in the Script Editor application
tell application "Finder" to set the index of the last Finder window to 1

TOP | CONTINUE