Jump to content

Unable to the result of MsgBox working...


Hyflex
 Share

Recommended Posts

I've tried to get the MsgBox's working for quite a while and searched the forums, stackoverflow and google but can't find how to resolve this. I've tried to create a messagebox in Scite but that too has the same issue where none of the results work except for the else... which is pretty useless.

See some example code below:

#include <MsgBoxConstants.au3>
;#include <GuiConstantsEx.au3>
$Status = "Test"
$Message = "Beep Beep"

If Not IsDeclared("UpdateResult") Then Local $UpdateResult
$UpdateResult = MsgBox($MB_OKCANCEL & $MB_ICONWARNING, $Status & " Available", "There is a " & $Status & "." & @CRLF & @CRLF & "Press OK to " & $Status & @CRLF & @CRLF & $Message)

Select
    Case $UpdateResult = 1 ;OK
        ConsoleWrite("Switch 1" & @CRLF)
    Case $UpdateResult = 2
        ConsoleWrite("Switch 2" & @CRLF)
EndSelect

If $UpdateResult = 1 Then
    ConsoleWrite("If 1" & @CRLF)
ElseIf $UpdateResult = 2 Then
    ConsoleWrite("ElseIf" & @CRLF)
Else
    ConsoleWrite("Else" & @CRLF) ; Only one that fires....
EndIf

How do I get OK button & cancel button to do things...?

Thanks

Link to comment
Share on other sites

  • 1 month later...

Like this?

#include <MsgBoxConstants.au3>
;#include <GuiConstantsEx.au3>
$Status = "Test"
$Message = "Beep Beep"

If Not IsDeclared("UpdateResult") Then Local $UpdateResult
$UpdateResult = MsgBox($MB_OKCANCEL + $MB_ICONWARNING, $Status & " Available", "There is a " & $Status & "." & @CRLF & @CRLF & "Press OK to " & $Status & @CRLF & @CRLF & $Message)

Select
    Case $UpdateResult = 1 ;OK
        ConsoleWrite("Switch 1" & @CRLF)
        ConsoleWrite("Select --- the first time I had to do something " & $UpdateResult & @CRLF )
    Case $UpdateResult = 2
        ConsoleWrite("Switch 2" & @CRLF)
EndSelect

If $UpdateResult = 1 Then
    ConsoleWrite("If 1" & @CRLF)
    ConsoleWrite("Select --- the second time I had to do something " & $UpdateResult & @CRLF )
ElseIf $UpdateResult = 2 Then
    ConsoleWrite("ElseIf" & @CRLF)
Else
    ConsoleWrite("Else" & @CRLF) ; Only one that fires....
EndIf

Like @InnI wrote, your MsgBox flags were wrongly formatted...

Skysnake

Skysnake

Why is the snake in the sky?

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