Jump to content

MsgBox Yes/No


Recommended Posts

Hi,

Not sure why it is not working here.

Everything else works good, except if I want to perform any of the actions (Say Step 1) then it should give me a msgbox first to proceed or not.

The code works for Step 1 but I am not getting that msgbox prior to that.

Also if I select NO then I just want the msgBox to close. Not the complete code.

Could you please help here.

 

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 388, 241, 750, 360)
$Step1 = GUICtrlCreateLabel("Step 1", 32, 40, 42, 20)
$Step2 = GUICtrlCreateLabel("Step 3", 216, 40, 42, 20)
$Step3 = GUICtrlCreateLabel("Step 2", 120, 40, 42, 20)
$Step4 = GUICtrlCreateLabel("Step 4", 312, 40, 42, 20)
$Input_Text = GUICtrlCreateInput("", 48, 104, 289, 24)
$OK = GUICtrlCreateButton("OK", 152, 176, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    $aInfo = GUIGetCursorInfo($Form1)
    If $aInfo[2] Then
        If $aInfo[4] = $Input_Text Then GUICtrlSetData($Input_Text, "")
    EndIf

    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit


        Case $OK
            Select
                Case GUICtrlRead($Input_Text) = '1'
                $verify = MsgBox(68, "", "Do you want to proceed with Step 1?")
                    Select
                        Case $verify = '6'
                            Exit
                        Case $verify = '7'
                            ; Cancel Exit
                    EndSelect
                    Msgbox(0,"","step1")

                Case GUICtrlRead($Input_Text) = '2'
                    Msgbox(0,"","step2")

                Case GUICtrlRead($Input_Text) = '3'
                    Msgbox(0,"","step3")

                Case GUICtrlRead($Input_Text) = '4'
                    Msgbox(0,"","step4")
            EndSelect

    EndSwitch
WEnd

 

Link to comment
Share on other sites

$verify = MsgBox(68, "", "Do you want to proceed with Step 1?")
                    Select
                        Case $verify = 6
                            ; YES, proceed with step 1
                            Msgbox(0,"","step1")
                        Case $verify = 7
                            ; NO thanks
                    EndSelect

 

Or simplier

If MsgBox(68, "", "Do you want to proceed with Step 1?") = 6 Then
                          Msgbox(0,"","step1")
                    EndIf

Ajag

Rule #1: Always do a backup         Rule #2: Always do a backup (backup of rule #1)

Link to comment
Share on other sites

I used something like this....

$verify = MsgBox(68, "", "Do you want to proceed with Step 1?")
                    Select
                        Case $verify = '6'
                            ; Cancel Exit
                        Case $verify = '7'
                            Continueloop
                    EndSelect
                    Msgbox(0,"","step1")

 

Link to comment
Share on other sites

  • Moderators

Or...

$firstQuestion = MsgBox(4, "", "My Test Question")
$answer = MsgBox(0, "", ($firstQuestion = 6) ? "You clicked Yes" : "You clicked No")

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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