Aequitas Posted August 14, 2014 Share Posted August 14, 2014 I have tried this so many different ways, but I cannot seem to get out of this while loop and have my script continue. My script gets to this function and executes the code within the while loop fine. I just cannot seem to get it to exit this while loop. I have also tried Do..Until loops, setting to while winexists() = false. Func _FixOfficeID() $pop = 12 While 1 If WinExists("Google - Windows Internet Explorer") Then ExitLoop EndIf $pop += 1 _IELinkClickByIndex($oIE, $pop) Sleep(500) _SendEx("{backspace}") Sleep(200) WEnd _WinWaitActivate($TITLE, $TEXT) _SendEx("{enter 2}") _SendEx("{left 5}") _SendEx("{CTRLDOWN}c{CTRLUP}") EndFunc ;==>_FixOfficeID $TITLE, $TEXT, and $oIE are set up as global from earlier in script. The bottom part of the function works correctly when tested without the while loop. Thank you in advance for your help Link to comment Share on other sites More sharing options...
November Posted August 14, 2014 Share Posted August 14, 2014 Hi there and welcome to AutoIT forum. Did you tried to output the winexists to see if is sucessufull? The winexists is the only condition tha get you out of the loop and continue your script. Try consolewrite(@error & @CRLF) after that statement. Cheers Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font] Link to comment Share on other sites More sharing options...
JohnOne Posted August 14, 2014 Share Posted August 14, 2014 WinExists("Google - Internet Explorer") AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
tommytx Posted August 14, 2014 Share Posted August 14, 2014 why not add something like this to see what the heck the loop is up to.. While 1 If WinExists("Google - Windows Internet Explorer") Then $cnt=$cnt+1 consolewrite($cnt & @CRLF) if $cnt> 5 then exit ExitLoop EndIf At least this way you will know for sure if the loop is able to intrepret the WinExists result or not.. and if not it quits after 5 loops or make it as many loops as you like but bottom line if its looping over and over then the WinExists is not qalifying Link to comment Share on other sites More sharing options...
Aequitas Posted August 14, 2014 Author Share Posted August 14, 2014 Thank you for the responses. The WinExists does work i tested with If WinExists("Google - Windows Internet Explorer") Then MsgBox(1, "abc", "abc") Else MsgBox(1, "def", "def") EndIf i get nothing with the consolewrite(@error & @CRLF) because I do not think it errors out, it just stays stuck in the loop. A little more background to see if you have any other ideas. What the while loop is doing is clicking an undetermined amount of links on the page that it is on. The first 13 links I do not want pressed.The links after that are JavascriptForm:Submit(******). Those are the ones I need to cycle through. The last on the page is always a link to a specific webpage (hence the WinExists to exit the loop) Link to comment Share on other sites More sharing options...
JohnOne Posted August 14, 2014 Share Posted August 14, 2014 How exactly are you certain that the while loop is not exited when this window appears? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Aequitas Posted August 14, 2014 Author Share Posted August 14, 2014 it does not execute the commands listed under the loop that were tested seperately and work _WinWaitActivate($TITLE, $TEXT) _SendEx("{enter 2}") _SendEx("{left 5}") _SendEx("{CTRLDOWN}c{CTRLUP}") Link to comment Share on other sites More sharing options...
JohnOne Posted August 14, 2014 Share Posted August 14, 2014 Please show your _WinWaitActivate function. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Aequitas Posted August 14, 2014 Author Share Posted August 14, 2014 Func _WinWaitActivate($TITLE, $TEXT = "", $TIMEOUT = 3600) If WinWait($TITLE, $TEXT, $TIMEOUT) Then If Not WinActive($TITLE, $TEXT) Then WinActivate($TITLE, $TEXT) EndIf WinWaitActive($TITLE, $TEXT) EndIf EndFunc ;==>_WinWaitActivate Func _SendEx($ss, $warn = "") Local $iT = TimerInit() While _IsPressed("10") Or _IsPressed("11") Or _IsPressed("12") If $warn <> "" And TimerDiff($iT) > 1000 Then MsgBox(262144, "Warning", $warn) EndIf Sleep(50) WEnd Send($ss) EndFunc ;==>_SendEx Global $TITLE = "Microsoft Excel" Global $TEXT = "Status Bar" Link to comment Share on other sites More sharing options...
JohnOne Posted August 14, 2014 Share Posted August 14, 2014 Are you able to post the website? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Aequitas Posted August 14, 2014 Author Share Posted August 14, 2014 I cannot post a link to the website (even if i did it is an internal site). the best I can do to get a better idea on what happens is list the links on the page with url replaced as google 17 links found https://google.com/software/software.cfm#Jump https://google.com/software/software.cfm?LinkID=Software https://google.com/report/reports.cfm?LinkID=Product https://google.com/administration/administration.cfm javascript:logoutUser(1) javascript:logoutUser(2) https://google.com/software/software.cfm?LinkID=Software https://google.com/software/software.cfm?LinkID=CheckOut https://google.com/software/software.cfm?LinkID=LicenseType https://google.com/software/software.cfm?LinkID=MediaType https://google.com/software/software.cfm?LinkID=Platform https://google.com/software/software.cfm?LinkID=Publisher https://google.com/software/software.cfm?LinkID=SearchDetail javascript:FormSubmit(28379); javascript:FormSubmit(26808); javascript:FormSubmit(28327); https://google.com/Help.pdf the while loop cycles through the 3 javascript:FormSubmit(*****); (which will not always be 3) and then opens the help.pdf. I was trying to use the Help.pdf opening to exit the While loop Link to comment Share on other sites More sharing options...
JohnOne Posted August 14, 2014 Share Posted August 14, 2014 This window that appears is a popup? Is it a real instance of internet explorer? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
JohnOne Posted August 14, 2014 Share Posted August 14, 2014 Does this script wok? HotKeySet("{Esc}", "_Exit") While 3 If Random(0, 1000000, 1) = 279 Then ExitLoop EndIf WEnd MsgBox(0,0,"Good") Func _Exit() Exit EndFunc AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Aequitas Posted August 14, 2014 Author Share Posted August 14, 2014 I believe it is. Below is the finder tool output, but like i said before i used this script (with the real url) and it returned abc If WinExists("Google - Windows Internet Explorer") Then MsgBox(1, "abc", "abc") Else MsgBox(1, "def", "def") EndIf >>>> Window <<<< Title: https://google/Help.pdf - Windows Internet Explorer Class: IEFrame Position: 1053, 100 Size: 800, 600 Style: 0x16CF0000 ExStyle: 0x00000100 Handle: 0x00000000003604D0 >>>> Control <<<< Class: Client Caption Instance: 1 ClassnameNN: Client Caption1 Name: Advanced (Class): [CLASS:Client Caption; INSTANCE:1] ID: Text: Position: 0, 0 Size: 784, 19 ControlClick Coords: 227, 14 Style: 0x54000000 ExStyle: 0x00000000 Handle: 0x000000000029046A >>>> Mouse <<<< Position: 1288, 114 Cursor ID: 0 Color: 0xFFFFFF >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< Navigation Bar https://google/Help.pdf Address Combo Control Page Control Favorites and Tools Bar ITBarHost Menu Bar https://google/Help.pdf - Windows Internet Explorer LocalEWH-10596-0 - Adobe Reader AVTableContainerView AVSplitterView AVSplitationPageView AVSplitterView AVScrolledPageView AVScrollView AVTableContainerView 8.50 x 11.00 in AVPageView >>>> Hidden Text <<<< AVUICommandWidget 76.7% 1 AVTabStripView AVDockableHostView AVRulerView 1 AVNullDocView Link to comment Share on other sites More sharing options...
JohnOne Posted August 14, 2014 Share Posted August 14, 2014 Try Opt("WinTitleMatchMode", 2) at top of script. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Aequitas Posted August 14, 2014 Author Share Posted August 14, 2014 I tried Opt("WinTitleMatchMode", 2) and tried changing WinExists("Help.pdf") Then still repeating the While loop Link to comment Share on other sites More sharing options...
JohnOne Posted August 14, 2014 Share Posted August 14, 2014 I'm out then I have no idea. Sorry. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Aequitas Posted August 14, 2014 Author Share Posted August 14, 2014 any ideas on another way to end the While loop? Link to comment Share on other sites More sharing options...
JohnOne Posted August 14, 2014 Share Posted August 14, 2014 It appear Exitloop does not work on your computer. So you should enumerate the links and use a for next loop. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Exit Posted August 14, 2014 Share Posted August 14, 2014 While 1 $pop += 1 _IELinkClickByIndex($oIE, $pop) If @error Then ExitLoop Sleep(500) _SendEx("{backspace}") Sleep(200) WEnd App: Au3toCmd UDF: _SingleScript() 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