Jump to content

more than one msgbox?


 Share

Recommended Posts

is it possible to have more than a single msgbox open on the screen simultaneously? I'm trying to specify 2 different points where a msgbox is to open, however I can only seem to get a single box to open at once, the other one only opens after clicking "Ok".

Link to comment
Share on other sites

Here is an example, using re-execution, that I have used to have multiple message boxes at once.    

If StringInStr($CmdLineRaw, '/MsgBoxData') Then ;Creates Return Message boxes.
    Opt("TrayIconHide", 1) ;Hide tray icon for rerun script that shows the Message box.
    $CmdLineRaw = StringSplit(StringMid($CmdLineRaw, StringInStr($CmdLineRaw, '/MsgBoxData')), ';')
    $aMsgBoxData = StringSplit($CmdLineRaw[2], "|")
    Switch $aMsgBoxData[0]
        Case 3
            MsgBox($aMsgBoxData[1], $aMsgBoxData[2], $aMsgBoxData[3])
        Case 4
            MsgBox($aMsgBoxData[1], $aMsgBoxData[2], $aMsgBoxData[3], $aMsgBoxData[4])
        Case 5
            MsgBox($aMsgBoxData[1], $aMsgBoxData[2], $aMsgBoxData[3], $aMsgBoxData[4], $aMsgBoxData[5])
    EndSwitch
    Exit
EndIf

Global $iReturnBoxPID
Global $sReturnBoxPIDs = ""

For $i = 0 To 10
    
    $iReturnBoxPID = _MsgBoxEx(0, "Test " & $i, "This is test " & $i & ".")
    $sReturnBoxPIDs &= $iReturnBoxPID & "|"
    
Next

Sleep(10000) ;Sleep to 10 sec.  

;Close all open message boxes
Global $aReturnBoxPIDs = StringSplit(StringTrimRight($sReturnBoxPIDs, 1), "|")
For $iPID = 1 To $aReturnBoxPIDs[0] Step 1
    ProcessClose($aReturnBoxPIDs[$iPID])
Next


Func _MsgBoxEx($iFlag, $sTitle, $sText, $iTimeOut = 0, $iHwnd = 0) ;Show a message box for the data.
    If $iTimeOut = 0 And $iHwnd = 0 Then
        $sMsgBoxDataEx = $iFlag & '|' & $sTitle & '|' & $sText
    ElseIf $iTimeOut <> 0 And $iHwnd = 0 Then
        $sMsgBoxDataEx = $iFlag & '|' & $sTitle & '|' & $sText &'|' & $iTimeOut
    Else
        $sMsgBoxDataEx = $iFlag & '|' & $sTitle & '|' & $sText & '|' & $iTimeOut & '|' & $iHwnd
    EndIf

     If @Compiled Then
         Return(Run(@ScriptFullPath & ' /MsgBoxData;' & $sMsgBoxDataEx))
     Else
         Return(Run(@AutoItExe & ' "' & @ScriptFullPath & '" /MsgBoxData;' & $sMsgBoxDataEx))
     EndIf
EndFunc

 

Adam

Edited by AdamUL
pragma not needed.
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...