Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a AHK script that looks for an active Emacs window and switches to it. However, since I'm using VirtuaWin now, this script stopped working -- it only works on the virtual display where Emacs actually is, but not on others. Any suggestions on what I can do?

share|improve this question
up vote 2 down vote accepted
DetectHiddenWindows, on

would detect it, but switching to the workspace it's on could be complicated.

share|improve this answer
Thanks, it actually works. The window is switched to, but it's also moved to current desktop. This I can live with ;) – Nikolai Prokoschenko Sep 1 '09 at 11:58
ooh, better than I expected :D – Phoshi Sep 1 '09 at 12:08

Old question, but in case anyone else stumbles upon it, if you always run Emacs (or whatever other application) on a specific desktop, you can use VirtuaWin's command line interface to switch desktops. Here's a snippet from my autohotkey.ahk to switch to desktop 5 and find or run visual studio:

    run c:\program files (x86)\VirtuaWin\VirtuaWin.exe -msg 1034 5
    sleep, 100
    SetTitleMatchMode, 2
    IfWinExist Microsoft Visual Studio
        Run C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe

A brief sleep is needed after the window switch or WinExist won't find it.

A list of all of the VirtuaWin msg commands is in the VirtuaWin help file, Advanced User Guide / External Interface.

Hope it helps.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.