Jump to content

Do.... Until WinActivate stuck (nested in If... Then)


Go to solution Solved by SorryButImaNewbie,

Recommended Posts

Hello everyone!

Sorry if this question should be in the generel help forum (it is there as well, also worded a bit differently, I solved many of the things i asked there, while another problem poped up)

As the title suggest, my problem is that once the window I'm waiting for in my Do until loop is poped up, the script stops. Tried to MsgBox to see if its leave the Do.. Until and has a problem with Endif but it seems that it stuck right at the end of the until line. Everything else works as intended (even if my logic is stupid sometimes, but Im a beginner so its okey for now)

Could it be the problem that both possible popup window has the same title? (thats why i definde the texts)

The code should try codes from an array i wrote inside the script in a textbox, but all codes can be used twice a day, so when it says that the code was used already, it jumps to tne next one until it finds a code that the other program accept.

The code as it follow

If WinExists("Információ", "Elérte a maximális napi vásárlási mennyiséget! ( 2 )") Then
Do
WinKill("Információ", "Elérte a maximális napi vásárlási mennyiséget! ( 2 )") ;message about code used 2 today already
$i = $i + 1
ControlFocus($handle, "", "TEdit1") ;entering the specification to the window/form where I try the next code
Send("{CTRLDOWN}v{CTRLUP}")
ControlClick($handle, "", "[CLASSNN:TAdvBitBtn23]")
WinWaitActive("Befizetés")
Local $handle3 = WinGetHandle("Befizetés") ;adding  the specification to the window/form where I try the next code
ControlSend($handle3, "", "[CLASSNN:TComboBox3]", "ü{ENTER}") 
ControlSend($handle3, "", "[CLASSNN:TEdit5]", $arrayEuroShell[$i])
ControlClick($handle3, "", "[CLASSNN:TBitBtn2]")
Sleep(1000)
Until WinActive("Információ", "Sikeres jegyvásárlás!") ;message of succesfull code entry
MsgBox(0, "Teszt", "Jelentem ki jöttünk a Do.... Until ágból!") ;test MsgBox
;~  ----------------------------------------------------???????????????????????????????????????????????????-------------------------------------- ;here is where i stuck (messagebox doesnt apper)
EndIf
 
Local $handleinfo = WinGetHandle("Információ", "Sikeres jegyvásárlás!") 
ControlClick($handleinfo, "", "[CLASSNN:TBitBtn1]")

 

Thank you for your help, and sorry if I shouldn't post these kind of questions here

 

Link to comment
Share on other sites

instead of waiting for a window to be active, wait for it to exist or is visible, then activate it.

also if you put this tray icon option in, you can hover over the tray icon for your script while it is running and see the exact line number that your script is running, or hanging on.

Opt("TrayIconDebug", 1)

:alien:

If @error Then
    MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!")
EndIf

"Yeah yeah yeah patience, how long will that take?"  -Ed Gruberman

REAL search results  |  SciTE4AutoIt3 Editor Full Version

Link to comment
Share on other sites

  • Solution

Ohhh my god thank you!!!

I never have thought of that that this simple line showed me... It seems like Do.. Until wants to run once more after the until expression was fullfiled. I concluded this by traytip showing me that script stands at line 760 which is WinWaitActivate("Befizetés")... I commented it out and tried with a sleep(1000) instead of it. It works, thank you so much alienclone!!! I stuck with this problem for 3 days for around 20 hours now.

Do you happend to know if Do.. Until runs one more time after the until expression is fullfiled as i assumed? Or is this because of something else?

(thank you again!!)

Link to comment
Share on other sites

do until will only run once unless inside something like While() WEnd.

you are probably mistaken if it seems to repeat.

:alien:

If @error Then
    MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!")
EndIf

"Yeah yeah yeah patience, how long will that take?"  -Ed Gruberman

REAL search results  |  SciTE4AutoIt3 Editor Full Version

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...