WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: jm0000 on April 20, 2018, 10:25:44 AM

Title: Toggling between screens in desktop
Post by: jm0000 on April 20, 2018, 10:25:44 AM
I have a big monitor that will be used to display several statistics.  A while back, using the old version of winbatch, I wrote a script that toggled between all the screens that were open in the desktop.  This script worked great, but that was on XP.  I'm trying to re-write the same script, but  Win10 is ignoring the command to flip the screens.  What is the best way to do this  using winbatch, ruining on win10. Here is what I have:

for i =  1 to  %countvar%
counter = %counter% -1
    Display(1,"Changing windows in","%counter%")
next i
  if IsKeyDown(@SHIFT) then goto end

;SendKey( '^!{TAB}~ {ENTER}"' )     ;Sends Keystrokes
sendkey("^{ALT}{ESC}")

end
Title: Re: Toggling between screens in desktop
Post by: td on April 20, 2018, 01:37:26 PM
You might try Window key + tab to open Task View or Atl + tab to switch between open apps.   Things can get a little tricky because Windows 10 has better support for virtual desktops.

The complete list of shortcuts for Windows 10 can be found here:

https://support.microsoft.com/en-us/help/12445/windows-keyboard-shortcuts (https://support.microsoft.com/en-us/help/12445/windows-keyboard-shortcuts)
Title: Re: Toggling between screens in desktop
Post by: jm0000 on April 20, 2018, 03:09:18 PM
Thanks for your reply. I really wanted to just toggle between all the open windows, like the old program, but that has proven difficult. I rewrote it just to open specific windows, but I am having an issues opening a google chrome window. Here is what I have

:again
     If Iskeydown(@CTRL) then goto end
    Display(1,"Changing windows in","%countvar% seconds")
   winactivate("Inbox") <-- opens email
    If Iskeydown(@CTRL) then goto end
    delay(countvar)   
  winactivate("MyDoc") <-- Opens word
   If Iskeydown(@CTRL) then goto end
  delay(countvar)

;can't open an existing chrome window
ActivateIeTab("winbatch.com")  <--- How can I activate an exiting chrome tab?

:goto agiain
Title: Re: Toggling between screens in desktop
Post by: td on April 22, 2018, 08:54:53 AM
If you start "WinBatch Navigator" and press the "Windows Information" button the applet "Wininfo" starts.  Put the cursor over your Chrome window to see it's window title.   You may need to use a "partial window name" to account for the title changing based on the Website being displayed.   You can find more information on partial window names in the Consolidated WIL Help file.
Title: Re: Toggling between screens in desktop
Post by: jm0000 on April 23, 2018, 08:54:23 AM
Thanks TD, the tip about the navigator helped me out. Here is the basic code. This will work. I'm going to make is more professional by using a data file to list the names of windows I would like to open.

:again

   winactivate("an adbode program") <-- just change this to the file name of any file you want to open
    If Iskeydown(@CTRL) then goto end
    delay(countvar)   
  winactivate("Am excel spreedsheet")
   If Iskeydown(@CTRL) then goto end
  delay(countvar)
       winactivate("a word doc")
   If Iskeydown(@CTRL) then goto end
  delay(countvar)




;; This will open google chrome pages.

Winactivate("WinBatch Navigator")
        If Iskeydown(@CTRL) then goto end
     delay(countvar)
Winactivate("CNN")
If Iskeydown(@CTRL) then goto end
delay(countvar)
Winactivate("Home")
If Iskeydown(@CTRL) then goto end
delay(countvar)
goto again

:end
Display(3,"END of swtab","Closing Swtab script")