Jump to content

Recommended Posts

Posted (edited)

Hey all,

I'm just trying to accomplish a simple goal that allows us to display streaming slides via Google Slides that then update every 5 minutes. Note that in this script I have it set as 5 seconds for testing.

I need the following to happen:

1. If "News" slides are already open, then just refresh (F5) every 5 minutes

2. If slides are not open, then create them before beginning the 5 minute refresh loop

3. If News is open but it's not the active screen, then make it the active screen, bring it to the front, and continue looping the refresh. If it's closed, then reopen it and then continue refresh loop.

I made an edit to the Else statement and its functional enough for #1 and #2, but incorporating #3 doesn't work with the code below. If the website is closed or if the script is cancelled and run again, it will create the window again. I'm sure this is just an order of operations thing and moving things out of or into While statements. I'm just not sure how to do a title check within a while statement, and if false, jump out of the while statement back to the beginning and then run the script again. ALmost like a "GoTo" function.

#include <IE.au3>

HotKeySet("!{x}", "ExitNow") 
Opt("WinTitleMatchMode", 3) 
Global $url = "URLHERE"
Global $title = WinGetTitle("News", "")

While 1
If $Title <> "" Then
   While 2
        WinActivate($title)
        WinWaitActive($title) 
        Send("{F5}")
        Sleep(5000)
   Wend
Else
   $oIE = _IECreate ($url, 1)
   $hIE = _IEPropertyGet($oIE, "hwnd")
   WinSetState($hIE, "", @SW_MAXIMIZE)
   WinWaitActive($Title)
   Sleep(1000)
   Send("{LCTRL}{LSHIFT}{F}") ; Should make Google Slides full screen. Issue with Google's hotkeys causing this not to work
   While 3
        WinActivate($title)
        WinWaitActive($title) ; This tells the script to not send the refresh key (F5) until the window has appeared.
        Send("{F5}")
        Sleep(5000)
   Wend  
EndIf
WEnd

Func ExitNow() 
Exit
EndFunc

 

Edited by ct253704
Updated code

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...