Jump to content

Creating two whiles loop at the same time.

Recommended Posts

I've been searching for a way on how to run two whiles at the same time. But i have no luck. Is there a way to make two whiles run at the same time? If not, is there any alternate way?

What I'm trying to do is, make both of the whiles to run at the same time. One is for checking errors constantly, and the other is sending msgboxes. If the error check comes out, the loop searching for the error, disables the other loop, then resumes it after clearing the error.

Link to comment
Share on other sites


check out AdlibRegister() in help file

FUNCTIONS: WinDock (dock window to screen edge) | EditCtrl_ToggleLineWrap (line/word wrap for AU3 edit control) | SendEX (yet another alternative to Send( ) ) | Spell Checker (Hunspell wrapper) | SentenceCase (capitalize first letter of sentences)

CODE SNIPPITS: Dynamic tab width (set tab control width according to window width)

Link to comment
Share on other sites

MsgBox will always pause your script, though you can use workaround with this:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 600, 400)
$Label1 = GUICtrlCreateLabel(Random(0, 99, 1), 10, 10, 580, 40)
$Button1 = GUICtrlCreateButton('New MessageBox', 10, 100, 100, 25)
$Timer1 = TimerInit()
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
        Case $Button1
            _NewMsgBox(0, 'title', 'text')
    If TimerDiff($Timer1) >= 500 Then
        $Timer1 = TimerInit()
        GUICtrlSetData($Label1, Random(0, 99, 1))
Func _NewMsgBox($Flag, $Title, $Text, $Timeout = -1, $hwnd = -1)
    Local $command = '"MsgBox(' & $Flag & ', ''' & $Title & ''', ''' & $Text & ''', ' & $Timeout & ')"'
    Run (@AutoItExe & ' /AutoIt3ExecuteLine  ' & $command)

So you see, numbers in main while will change even though there is msgbox started

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

  • Recently Browsing   0 members

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