#.::
IfWinExist Chrome
WinActivate
else
Run Chrome
return
Works just fine when the Chrome application is not running (i.e., when I just started my computer). But when chrome is running, it does not behave like I want to. It simply creates a new window. If I have a certain Chrome window active, then it creates a new window on top of that. If, however, I run Notepad and hit #. then a new window is created in the background, and I am still facing Notepad.
(I 'veread http://www.autohotkey.com/board/topic/7129-run-a-program-or-switch-to-an-already-running-instance/)
What I want to do, is to switch to the previous chrome window just as if I used #{tab}. And if there is no chrome window active, then and only then I wish to open a new one.