Link to home
Start Free TrialLog in
Avatar of Gopher1976
Gopher1976

asked on

How to simulate ALT, TAB (To switch between windows!)

Hi All

Basically, in our office we have a huge 50 inch plasma which we want to use to display information obout our LAN, WAN, Email, Sap perfromance Etc. Currently we can only display one at a time and to switch we have to log on and switch it manually.

What I want to do is write a VB Script which simulates the Alt + Tab (switch screens) and then set up a scheduled task to execute it evey 2 mins.

Does anyone know how to do this and, if possible, set the amount of times Tab is pressed so that you can switch between 4 or 5 screens?

If you need anymore information please let me know

Thanks

Gopher
Avatar of cheeselover73
cheeselover73
Flag of Serbia image

Hope this will help:

Dim counter
counter = 10
While counter > 0
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.SendKeys "%{tab}"
WScript.Sleep(5000)
WshShell.SendKeys "%({tab}{tab})"
WScript.Sleep(5000)
WshShell.SendKeys "%({tab}{tab}{tab})"
WScript.Sleep(5000)
WshShell.SendKeys "%({tab}{tab}{tab}{tab})"
WScript.Sleep(5000)
WshShell.SendKeys "%({tab}{tab}{tab}{tab}{tab})"
WScript.Sleep(5000)
WshShell.SendKeys "%({tab}{tab}{tab}{tab}{tab}{tab})"
WScript.Sleep(5000)
wend

5000 is miliseconds
save it as something.vbs and simply start it with doubleclick
Avatar of Gopher1976
Gopher1976

ASKER

Thats great!

However I have another quick question - can you prompt a screen refresh after it tabs?

If you can tell me how would you exactly refresh screen if you were logged on with mouse and keyboard?
It will be an IE Session so just F5.
ASKER CERTIFIED SOLUTION
Avatar of cheeselover73
cheeselover73
Flag of Serbia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I am no VB programer, but I believe you could also refresh screen, lets say every 10 seconds, during that 2 minutes you are looking at one screen:
...
WshShell.SendKeys "%({tab}{tab})"
WScript.Sleep(1000)
times = 12
While times > 0
WshShell.SendKeys "{F5}"
WScript.Sleep(10000)
times=times -1
wend
WshShell.SendKeys "%({tab}{tab}{tab})"
....
Superb, exactly what I asked for - Thanks