tuffgong Posted March 30, 2016 Share Posted March 30, 2016 Good Morning! I used AutoIT pretty extensively in a previous job. After a 2-year break I am finally getting back into it at my new job. I have been given a small project that I haven't even begun to write yet because the planning is making my head hurt. I have used timer loops before but I am afraid my understanding is limited and help would be appreciated. I have a display board that needs to display 2 separate intranet pages. One of the pages needs to be refreshed every minute or so (the other automatically refreshes) and I need to alternate which page is displayed every 3 minutes. I have scripts that run pages on boards already, and they are on an endless refresh loop. How do I incorporate the refresh loop into another loop that will switch pages? include <IE.au3.> $oIE = _IECreate() _IENavigate($oIE, "http://****Intranet Page 1****") _IELoadWait($oIE) $oIE2 = _IECreate() _IENavigate($oIE2, "http://****Intranet Page 2****") _IELoadWait($oIE2) While 1 Sleep(1000) $dif = TimerDiff($begin) If $dif > (60 * 1000) Then $StillRunning = _IEAction($oIE2, "refresh") If $StillRUnning <> "1" then Exit $begin = TimerInit() EndIf WEnd So, how do I make a timer loop that switches between $oIE and $oIE2 every three minutes while still refreshing $oIE2 every minute or so. Thanks! Link to comment Share on other sites More sharing options...
MichaelHB Posted March 30, 2016 Share Posted March 30, 2016 i don't know if i understand you intent right, but is something like this? #include <IE.au3> $oIE = _IECreate() _IENavigate($oIE, "http://****Intranet Page 1****") _IELoadWait($oIE) $oIE2 = _IECreate() _IENavigate($oIE2, "http://****Intranet Page 2****") _IELoadWait($oIE2) $oIEFocus = $oIE If IsObj($oIEFocus) Then WinActivate(HWnd($oIEFocus.hWnd)) While 1 Sleep(1000) $dif = TimerDiff($begin) $dif2 = TimerDiff($begin2) ; you will need to creat this variable If $dif > (60 * 1000) Then $StillRunning = _IEAction($oIE2, "refresh") If $StillRUnning <> "1" then Exit $begin = TimerInit() EndIf If $dif2 > (180 * 1000) Then If $oIEFocus = $oIE Then $oIEFocus = $oIE2 Else $oIEFocus = $oIE EndIf If IsObj($oIEFocus) Then WinActivate(HWnd($oIEFocus.hWnd)) $begin2 = TimerInit() EndIf WEnd Link to comment Share on other sites More sharing options...
Developers Jos Posted March 30, 2016 Developers Share Posted March 30, 2016 (edited) -or- expandcollapse popup#include <IE.au3> $oIE1 = _IECreate("http://google.com", 0, 1, 1) $oIE2 = _IECreate("http://telegraaf.nl", 0, 0, 1) ; refresh IE2 every minute AdlibRegister("RefreshIE2", 60000) While 1 ; pause 60 seconds Sleep(60000) ; Check current status of both Sessions $ie1stat = _IEPropertyGet($oIE1, "visible") ; If error then session isn't there anymore If @error Then ; close other sesion and bail _IEQuit($oIE2) Exit EndIf $ie2stat = _IEPropertyGet($oIE1, "visible") ; If error then session isn't there anymore If @error Then ; close other sesion and bail _IEQuit($oIE1) Exit EndIf ; swap visible webpage If $ie1stat Then _IEAction($oIE1, "invisible") _IEAction($oIE2, "visible") Else _IEAction($oIE1, "visible") _IEAction($oIE2, "invisible") EndIf WEnd Func RefreshIE2() $rc = _IEAction($oIE2, "refresh") ConsoleWrite('! refresh IE2' & @CRLF) ;### Debug Console EndFunc ;==>RefreshIE2 Jos Edited March 30, 2016 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
MaxPlankpar Posted March 30, 2016 Share Posted March 30, 2016 The other toolbox <META HTTP-EQUIV="refresh" CONTENT="60;URL=somepage.html"> Link to comment Share on other sites More sharing options...
tuffgong Posted March 31, 2016 Author Share Posted March 31, 2016 Thanks so much for the great responses. I really appreciate all of the help. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now