[KLUG Members] scriptomatically toggle through multiple desktops

Mark Bystry mabystry at verizon.net
Mon Jun 6 08:41:47 EDT 2005


Ron,

  not sure if this is what you are after. my vbscripting is rusty. here at the office i have two 
linux servers that i vnc into. one is a red hat server and the other is a suse server. i workstation 
has windows xp on it with tightvnc as my client. both linux servers are running vncserver.

  i used tightvnc to save both connections out to disc and i called them RedHat.vnc and SuSE.vnc. 
These are just basically shortcuts or links. I also wrote a quick and dirty script to open the 
redhat vnc first, pause for 3 seconds, close the vnc window(this isn't working for some reason), 
pause for 3 seconds, open the suse vnc, pause for 3 seconds, close the vnc window.

  the script works but for some reason i cannot do an alt+f4 to close the window.

  maybe you can get it to work or alter the script.

below is the contents of the script
toggle_vnc.vbs

' VBScript to cyce thru tighvnc clients

Dim vbNo1
   vbNo1 = MsgBox ("Do you want to cycle thru your tightvnc desktop's?", 36, "TightVNC Script")
   If vbNo1 = 7 Then
   wscript.quit
   end if	

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run("""D:\Temp2\RedHat.vnc""")

'########################## THIS SECTION NOT WORKING ##########################
' close the windows in 3 seconds
WScript.Sleep 3000
  If WshShell.AppActivate("root's x desktop (linux.workgroup:1)") then

WshShell.SendKeys "%{f4}"
'########################## THIS SECTION NOT WORKING ##########################

else
  wscript.quit
end if

' relax for 3 seconds before the next desktop opens
WScript.Sleep 3000

Dim vbNo2
   vbNo2 = MsgBox ("Do you want to open another desktop?", 36, "TightVNC Script")
   If vbNo2 = 7 Then
   wscript.quit
   end if	

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run("""D:\Temp2\SuSE.vnc""")

'########################## THIS SECTION NOT WORKING ##########################
' close the windows in 3 seconds
WScript.Sleep 3000
  If WshShell.AppActivate("eng's x desktop (linux:1)") then

WshShell.SendKeys "%{f4}"
'########################## THIS SECTION NOT WORKING ##########################

else
  wscript.quit
end if

' end of code


Mark Bystry
SuSE 9.3 Pro
KDE 3.4.0


Ron Sweeney wrote the following on 6/6/2005 5:47 AM:
> can anybody tell me if there is a utility or know how to manipulate
> desktops so that I can script moving between desktops on a timed like
> basis?
> 
> 
> kinda like this with the real "show desktop" method...
> 
> while (1) {
> 
> 
> `show desktop 1`;
> 
> sleep(300);
> 
> `show desktop2`;
> 
> sleep(300);
> 
> `show desktop3`;
> 
> sleep (300);
> 
> 
> }
> ...
> 
> _______________________________________________
> Members mailing list
> Members at kalamazoolinux.org
> 
> 


More information about the Members mailing list