Monday, January 14, 2013

Keeping 2 Remote Desktops active

How to keep 2 or more Remote Desktops active ?

When you have 2 machines say 1 for execution ( i.e., running automation scripts and the other to do day to day activity) or you might have access to run automation scripts in few machines , then there is a need to keep all the machine active.

Below is the piece of code which can help you achieve this .

Dim i,sW_count,iTime_delay
set oShell =createobject("Wscript.Shell")
i=0
sW_count=Inputbox("Enter number of windows")
Redim Window_Name(sW_count-1)

For iCount=0 to sW_count-1
 Window_Name(iCount)=inputbox("enter exact name as found in the Title box the window")
Next

iTime_delay=Inputbox("Enter time before next trigger in seconds")   iTime_delay=iTime_delay*1000
For iCount=0 to sW_count-1
 WScript.Sleep(500)
 oShell.AppActivate(Window_Name(iCount))
 WScript.Sleep(500)
 oShell.SendKeys "% x"   'to maximize the window
next

do until i=1
 for iCount=0 to sW_count-1
  oShell.AppActivate(Window_Name(iCount))
  WScript.Sleep(iTime_delay)     
 next 
loop


How to use :
  1.  Copy this piece of code in a text file and save it with an extension as ".vbs".
  2. Double click on the file.
  3. Enter how many windows you wish to keep alive.
  4. Enter the exact names of all the windows as on the title bar of the window E.g:CATCHBUG.blogspot.com - Windows Internet Explorer
  5. Enter after how many seconds you wish to trigger the window in seconds Eg: 120   (This will trigger each window after 120 seconds )
  6. To close this script open task manager kill the "wscript" process. 
Note :
  1. This script should be used in conjunction with any key stroke or mouse simulation tool.
  2. This works only on windows platform.

No comments:

Post a Comment