Sign in to follow this  
Followers 0
MattyJ2009

Next and Retry Button For Loop

3 posts in this topic

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

Share this post


Link to post
Share on other sites



Try to make a GUI with Koda Form Designer. It will give you an easy way to develop a GUI for your application. I think having a look at that will help.

Share this post


Link to post
Share on other sites

I will take a look at that.

Thanks!

Share this post


Link to post
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
Sign in to follow this  
Followers 0