Added ability to auto select the window used instead of prompting.