Jump to content

How to use the retry or tryagain button?


Go to solution Solved by Luke94,

Recommended Posts

Posted

I want to make a small script, no GUI, just a script with some buttons for abort, retry and continue. (msgbox, 70)

For example the script should check if a @MIN value is reached or not. 

If it is reached, then go on and do this and that...

If not the retry button should be pressed again to check if reached or not. 

I am not sure how to handle the loop and the botton (msgbox, 70) together.

Tried to search it, but found only GUI solutions. 

Thank you

  • Solution
Posted (edited)

I don't quite understand the full ins and outs of your script but is this of any help?

#include <MsgBoxConstants.au3>

Global $g_iInteger = 0
Global $g_iMsgBox

While 1
    If $g_iInteger >= @MIN Then
        _DoSomething()
        $g_iInteger = 0
    Else
        $g_iMsgBox = MsgBox($MB_CANCELTRYCONTINUE, @ScriptName, 'Integer = ' & $g_iInteger & ', @MIN = ' & @MIN & '. What should I do?')
        Switch $g_iMsgBox
            Case $IDCANCEL
                ExitLoop
            Case $IDRETRY
                ContinueLoop
            Case $IDCONTINUE
                _DoSomething() ; I assume by continue you'd want to execute the code?
                $g_iInteger = 0 ; Should you reset the counter?
        EndSwitch
        $g_iInteger += 1
    EndIf
WEnd

Func _DoSomething()
    MsgBox(($MB_OK + $MB_ICONINFORMATION), @ScriptName, 'Integer = ' & $g_iInteger & ', @MIN = ' & @MIN)
EndFunc

 

Edited by Luke94

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
  • Recently Browsing   0 members

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