Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Restart script if winwait doesn't happen

$
0
0
Hi All,

Please excuse my dumbness! I am not a great scripter but have been working on a script for a friend how has had issues with their internet. I have created a script to Ping something like Google  if no connection it then runs a script, however, if the issue is with the router rebooting due to a power surge and the page doesn't load, how can I get the script to reboot and start from the beginning?

[ autoit ]         
While 1 $var = Ping("www.google.com") If not @error Then MouseMove (0, 728) MouseClick ("left") Sleep (500) MouseClick ("left") Sleep (1000000) Else MouseMove (150, 749) MouseClick ("left") Sleep (500) MouseClick ("left") run( "C:\Program Files\Internet Explorer\IEXPLORE.EXE -new http://192.168.1.1/setup.cgi?next_file=RST_st_poe.htm","") WinWaitActive("Windows Security") ControlClick("Windows Security", "", "[CLASS:Edit; INSTANCE:1]") Send ("{CTRLDOWN}") Send ("a") Send ("{CTRLUP}") Sleep (500) Send ("****") Sleep (500) Send ("{TAB}") Sleep (500) Send ("*****") Sleep (500) Send ("{ENTER}") Sleep (5000) WinWaitActive("NETGEAR Router DGND3700v2 - Windows Internet Explorer") Send ("{ALTDOWN}") Sleep (100) Send ("{SPACE}") Sleep (100) Send ("{ALTUP}") Sleep (500) Send ("x") Sleep (3000) MouseMove (733, 88) MouseClick ("left") Sleep (5000) MouseMove (657, 265) MouseClick ("left") Sleep (5000) ControlClick("Windows Internet Explorer", "", "[CLASS:Button; INSTANCE:1]") Endif WEnd

So if the WinWaitActive("Windows Security") isn't found, how can it tell the script to start again?

Please not that the below bit after ELSE is to close all current windows:

MouseMove (150, 749)
MouseClick ("left")
Sleep (500)
MouseClick ("left")

Thanks in advance for any help :)

GSC

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>