Jump to content
Sign in to follow this  

more than one msgbox?

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

Share this post

Link to post
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])

Global $iReturnBoxPID
Global $sReturnBoxPIDs = ""

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

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

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
        $sMsgBoxDataEx = $iFlag & '|' & $sTitle & '|' & $sText & '|' & $iTimeOut & '|' & $iHwnd

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



Edited by AdamUL
pragma not needed.
  • Like 1

Share this post

Link to post
Share on other sites
27 minutes ago, JLogan3o13 said:

Or, much more simply - just create your own MsgBox GUIs

ahhhh, very good point, ty

Share this post

Link to post
Share on other sites

From the 'usability' perspective, it would be better to combine the messages into one popup...no one like closing 1 million popups.

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

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