title: VBScript - switching focus to window using AppActivate
body: <p>We have multiple TVs each connected to a different computer. The goal is to display/setfocus  on a continuous loop cycling through two applications. This has to be synchronized across all TVs. Originally i had set it up cycle through all the apps in the task bar by sending the alt+esc key. Which worked fine but had a hard time synchronizing it across all TVs. So i used the AppActivate to setfocus and switch between windows based on even/odd minute. It is now synchronized, but the screen seems to try to setfocus to the window every second therby causing the screen to flicker all the time. How can i avoid it??? Any suggestions???
  Here is the part of the code.</p>
  
  <pre><code>' Loop lasts 1 second
  
  intSleep = 1000
  
  Set wshShell = CreateObject("WScript.Shell")
  
  'repeat process indefinetly
  
  Do while infiniteloop=0
      a = minute(time())
      intResult = a Mod 2  ' to check for even/odd minute
  
      If intResult = 0 Then
          'display window1
         if wshShell.AppActivate "Display - [Dashboard]" = false then
              wshShell.AppActivate "Display - [Dashboard]"
         end if
  
      ElseIf intResult = 1 Then
          'display window2
          if wshShell.AppActivate "Display - [TEST]" = false then
              wshShell.AppActivate "Display - [TEST]" 
         end if
  
      End If
      Wscript.Sleep intSleep
  
  Loop
  </code></pre>