Jump to content

Next and Retry Button For Loop


Recommended Posts

I have a script that reads numbers from a file and puts it in a textbox and does a search.  If the script doesn't find a match I would like to be able to have a next button so it will go to the next line of the file.  I would also like a retry button just in case the script would mess up and need to go back and retry the search again.  I have the my current code below.  I'm just not sure where to even start with getting this to work. 

#include <Array.au3>
#include <File.au3>
#include <IE.au3>
msgbox(0,"Get Ready...","After you press OK here this script is going to start working.  Make sure you have everything open and ready.")
WinWaitActive("xxxxxxxx - Internet Explorer", "")
Send("^f")
Send("!c")
Global $Paused
HotKeySet("{ESC}", "TogglePause")
$counter = 0
Local $aInput
$file = "C:\test.txt"
_FileReadToArray($file, $aInput)
For $i = 1 to UBound($aInput) -1
   $counter = FileReadLine($file, $i)
   Sleep(500)
   Send("!c")
   Sleep(1000)
   ControlSend("xxxxxxxx - Internet Explorer", "", "[CLASS:Internet Explorer_Server]", "{TAB 4}")
   Send($counter)
   Sleep(500)
   Send("!q")
Do
   ControlSetText("xxxxxxx - Internet Explorer", "", "[CLASS:Edit; INSTANCE:2]", "Result can't be found") ; searches for Result can't be found
   Sleep(500)
Until WinActive("", "1 match") ;After match is found we can go to the next line
Next


While 1
  Sleep(100)
WEnd
;;;;;;;;

Func TogglePause()
  $Paused = NOT $Paused
  While $Paused
    sleep(100)
    ToolTip('Script is "Paused"',0,0)
  WEnd
  ToolTip("")
EndFunc
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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