Application to automatically switch between two applications in Windows [closed]

Solution 1:

Yes, it is called AutoIt.

You would use something like this:

While 1 ;loop indefinitely
    WinActivate("notepad","") ;give focus to notepad
    Sleep(30000) ;sleep 30 seconds
    WinActivate("wordpad","") ;give focus to wordpad
    Sleep(30000) ;sleep 30 seconds
WEnd

WinActivate() gives focus to the window with exact or closest matching title, in cases where there are two that fit, it gives focus to the most recently activated one. Sleep() is in milliseconds, so 30000 is 30 seconds.

Solution 2:

AutoTab is very simple.

http://www.analogx.com/contents/download/System/autotab/Freeware.htm

Solution 3:

Why install a program (like AutoIt) when Windows can do this out of the box?

Save the following into a file called auto_switch.vbs:

Option Explicit
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
Do
    WScript.Sleep 30000
    WshShell.SendKeys("%{TAB}")
Loop

Change the 30000 to be the number of milliseconds (so 30000 = 30 seconds) between Alt+Tab presses. Double click on it to start it running.

If you want to stop it, then you need to kill the process called "wscript".

If you want to switch between explicitly named programs then this code will flip between "Inbox - Microsoft Outlook" and "Firefox" every 30 seconds:

Option Explicit
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
Do
    WScript.Sleep 30000
    WshShell.AppActivate("Inbox - Microsoft Outlook")
    ' WshShell.SendKeys "% r"
    WScript.Sleep 30000
    WshShell.AppActivate("Firefox")
    ' WshShell.SendKeys "% r"
Loop

It's worth noting that if the applications in the example above are minimized then they will remain minimized even after they are activated.

To restore the window as well, remove the ' in front of the WshShell.SendKeys. This will make the script active the window and then immediately send the restore key combination Alt+SpaceBar, r. If you're using a non-English version of Windows, you may need to change this shortcut.