If anyone googles how to do this, here is the solution we found, it works with unsaved windows (hence the "untitled", you would have to change that depending on your use)<br><br>----------<br><br>In the command, execute the system comand (ours is Ruby, so backticks)<br>
`osascript switch_windows.applescript`<br><br>----------<br><br>Then in your Support directory, the file: switch_windows.applescript<br><br>tell application "TextMate"<br>    activate<br>end tell<br>tell application "System Events"<br>
    set found_window to false<br>    set all_windows to every window of process "TextMate"<br>    repeat with w in all_windows<br>        if name of w contains "untitled" then<br>            set editor_window to name of w<br>
            set found_window to true<br>        end if<br>    end repeat<br>    <br>    if found_window then<br>        <br>        tell process "TextMate"<br>            tell menu bar 1<br>                tell menu bar item "Window"<br>
                    tell menu "Window"<br>                        click menu item editor_window<br>                    end tell<br>                end tell<br>            end tell<br>        end tell<br>    end if<br>
end tell<br>