Use Applescript/Automator to select a window highlighted in the Finder I have an applescript which extracts the name, associated process and and other information about a target window.  As of now, the script selects the target window via a "choose from list" dialog that contains all open windows from all processes.  It would be much better if I could select the target window by highlighting it in the Finder. For example, this can be done for files and folders: 

tell application "Finder" to set this_file to the selection


Question: Is there an equivalent method to do select windows from the Finder (using Applescript or Automator)?
Well you can ask Finder for its windows. The order returned is topmost to bottommost. 

If you have a specific window you want, and know its name then just ask it to activate...

tell application "Finder"
    set w to (name of every window)
    set i to (id of every window)

    tell window named "Desktop" to activate

    get front window
end tell


And the results...

tell application "Finder"
    get name of every window
        --&gt; {"Desktop", "Development", "Downloads"}
    get id of every window
        --&gt; {16267, 16290, 16265}
    activate window "Desktop"
        --&gt; Finder window id 16267
    get window 1
        --&gt; Finder window id 16267
end tell


Hope that helped...