Use Applescript/Automator to select a window highlighted in the Finder
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...