Thursday, 9 July 2009

A simple WSH script to simulate ALT-TAB continuously

Set WshShell = WScript.CreateObject("WScript.Shell")
While true
WScript.Sleep 4000 ' 4000 ms = 4 seconds
WshShell.SendKeys "%{ESC}" ' "%{TAB} doesn't work well


In a Usenet newsgroup I've been asked to simulate the ALT-TAB (switching active windows) behaviour in Windows, without installing new software. This simple Vbs\WSH script (save as myscript.vbs and run with cscript.exe or wscript.exe accomplishes the task. I actually simulate the ALT-ESC behaviour instead of ALT-TAB (it's the %{ESC} thing) which doesn't seem to run right on WSH - ALT-ESC is the same, it's just in order of opening.

Also check out - a free utility I've found very useful in the past.

No comments:

Post a Comment