Jump to content

Display two Messages Boxes at Once


 Share

Recommended Posts

  • Moderators

TarwadaC4,

Welcome to the AutoIt forum. :D

You could use Yashied's NotifyBox UDF. Or code it yourself something like this:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$hGUI = GUICreate("Test", 500, 500)

$hButton = GUICtrlCreateButton("Show", 10, 10, 80, 30)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton
            _Double_Box()
    EndSwitch

WEnd

Func _Double_Box()

    $iCount = 2

    $hBox_1 = GUICreate("MsgBox 1", 200, 200, 100, 100, BitOR($WS_POPUPWINDOW, $WS_CAPTION))
    $hButton_1 = GUICtrlCreateButton("OK", 10, 10, 80, 30)
    GUISetState()

    $hBox_2 = GUICreate("MsgBox 2", 200, 200, 100, 400, BitOR($WS_POPUPWINDOW, $WS_CAPTION))
    $hButton_2 = GUICtrlCreateButton("OK", 10, 10, 80, 30)
    GUISetState()

    While 1

        $aMsg = GUIGetMsg(1)
        Switch $aMsg[1]
            Case $hBox_1
                Switch $aMsg[0]
                    Case $GUI_EVENT_CLOSE, $hButton_1
                        GUIDelete($hBox_1)
                        $iCount -= 1
                EndSwitch
            Case $hBox_2
                Switch $aMsg[0]
                    Case $GUI_EVENT_CLOSE, $hButton_2
                        GUIDelete($hBox_2)
                        $iCount -= 1
                EndSwitch
        EndSwitch
        If $iCount = 0 Then Return
    WEnd

EndFunc

Try to understand how it works. Please ask questions if you do not. :oops:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

You can hit the space key 10 times

For $i = 0 To 9
    Send("{SPACE}")
Next

Or it could be better to send ten spaces as a string, depending on the purpose.

#include <String.au3>
Dim $string = _StringRepeat(" ", 10)
Send($string)
Edited by czardas
Link to comment
Share on other sites

  • Moderators

TarwadaC4,

im new here

So new that you have obviously not yet had time to read the Forum Rules. If you do so now you will see that we do not support any scripts to do with gaming - so do not expect any more help on that part of the thread. :oops:

i want to learn

Good! :D

Reading the Help file (at least the first few sections - Using AutoIt, Tutorials and the first couple of References) will help you enormously. You should also look at the excellent tutorials that you will find here and here - you will find other tutorials in the Wiki (the link is at the top of the page). There are even video tutorials on YouTube if you prefer watching to reading. :rip:

Have fun learning to code with AutoIt - but remember, no games-related scripts in the future! :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

It's very important that you read the forum rules. Discussion about gaming or posting scripts for gaming is not accepted here.

http://www.autoitscript.com/forum/forum-2/announcement-13-forum-rules/

Stick to the message boxes and you will be fine. I won't report this, but please follow the rules.

Edit

Ah Melba got there first.

Edited by czardas
Link to comment
Share on other sites

#include <GUIConstants.au3>

Example() ; Run the example

Func Example() ; Example of a basic function
    Local $hGUI = GUICreate("Test Button", 200, 150) ; Create GUI
    Local $hBtn = GUICtrlCreateButton("Click Me", 10, 10) ; Create button
    GUISetState()
    While 1
        $msg = GUIGetMsg() ; Get messages sent to the GUI
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop ; Exiting the loop here terminates all commands
        If $msg = $hBtn Then MsgBox(0, "Info", "You clicked the button")
    WEnd
EndFunc

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