Jump to content
Sign in to follow this  
HankHell

more than one msgbox?

Recommended Posts

HankHell

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
AdamUL

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.
  • Like 1

Share this post


Link to post
Share on other sites
HankHell
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
jdelaney

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  

×