Jump to content

MsgBox


Recommended Posts

How do you read the return value for the button pressed as this does not work

msgbox(1,"sSentry","Alt+F1 Help" & @CRLF & _

"Alt+End Close sSentry" & @CRLF & _

"Alt+L Display Log File" & @CRLF & _

"Alt+I Edit INI File" & @CRLF & _

"Alt+R Restore Default INI File ", 10)

If @error = 1 Then

msgbox(0,"","Ok Pressed")

EndIf

Link to comment
Share on other sites

A very nice tool is "hidden" in SciTe :)

... it is called "Code Wizard" (shortcut Alt-W)

You can play with various MessageBoxes and get the code for them :)

Give it a try.

Thanks again :) so much to learn so little time...

This code works a treat

Local $iMBAns

$iMBAns = msgbox(1,"sSentry","Alt+F1 Help" & @CRLF & _

"Alt+End Close sSentry" & @CRLF & _

"Alt+L Display Log File" & @CRLF & _

"Alt+I Edit INI File" & @CRLF & _

"Alt+R Restore Default INI File ", 10)

Select

Case $iMBAns = 1 ;OK

Case $iMBAns = 2 ;Cancel

EndSelect

msgbox(0,"",$iMBAns)

Link to comment
Share on other sites

Dim $result = MsgBox(0, "", "")

If $result = ... Then

...

Two ways of doing it wow :) Thanks for your help and this is the code:

Dim $result = msgbox(1,"sSentry","Alt+F1 Help" & @CRLF & _

"Alt+End Close sSentry" & @CRLF & _

"Alt+L Display Log File" & @CRLF & _

"Alt+I Edit INI File" & @CRLF & _

"Alt+R Restore Default INI File ", 10)

If $result = 1 Then

Msgbox(0,"","OK Pressed")

elseif $result = 2 Then

Msgbox(0,"","Cancelled Pressed")

EndIf

Link to comment
Share on other sites

Two ways of doing it wow :) Thanks for your help and this is the code:

Another variation on the same theme if you don't actually need to store the result in a variable for later

If MsgBox(1,"test","Test") = 1 then 
    Msgbox(0,"","You clicked OK")
Else
    Msgbox(0,"","You clicked Cancel")
EndIf
Link to comment
Share on other sites

Another variation on the same theme if you don't actually need to store the result in a variable for later

If MsgBox(1,"test","Test") = 1 then 
    Msgbox(0,"","You clicked OK")
Else
    Msgbox(0,"","You clicked Cancel")
EndIf
Wow three different ways to do it that's cool. Thanks for the input
Link to comment
Share on other sites

To those that helped with the Msgbox Return Value this is how I ended up using it:

CODE
;Keys Monitor

;

Func KeysMonitor()

$dll = DllOpen("user32.dll")

If _IsPressed('12', $dll) And _IsPressed('70', $dll) Then ; Alt + H to display Keys Monitor Help

DllClose($dll)

msgbox(262208,$Title & " Help","Alt+F1 Help" & @CRLF & _

"Alt+End Close sSentry" & @CRLF & _

"Alt+L Display Log File" & @CRLF & _

"Alt+I Edit INI File" & @CRLF & _

"Alt+R Restore Default INI File " & @CRLF & _

"Ctrl+End Close Skype", 10)

EndIf

If _IsPressed('12', $dll) And _IsPressed('23', $dll) Then ; Alt + End to Close sSentry

DllClose($dll)

If Msgbox(262161,$Title," CLOSE sSentry..") = 1 Then

ISExit()

EndIf

EndIf

If _IsPressed('12', $dll) And _IsPressed('4C', $dll) Then ; Alt + L to Display Current Log File

DllClose($dll)

ShellExecuteWait((@YDAY) & "sSentry.txt", "", @ScriptDir & "\LogFiles", "Open")

EndIf

If _IsPressed('12', $dll) And _IsPressed('49', $dll) Then ; Alt + I to Edit the INI File

DllClose($dll)

If Msgbox(262161,$Title," EDIT sSentry.ini..") = 1 Then

Global $DefaultPingID1 = IniRead(@ScriptDir & "\sSentry.ini", "PingID1", "value", "")

Global $DefaultPingID2 = IniRead(@ScriptDir & "\sSentry.ini", "PingID2", "value", "")

Global $DefaultSentry1 = IniRead(@ScriptDir & "\sSentry.ini", "AppSentry1", "value", "")

Global $DefaultSentry2 = IniRead(@ScriptDir & "\sSentry.ini", "AppSentry2", "value", "")

ShellExecuteWait("sSentry.ini", "", @ScriptDir, "Edit")

CheckConfig()

EndIf

EndIf

If _IsPressed('12', $dll) And _IsPressed('52', $dll) Then ; Alt + R to Restore INI to the Default

DllClose($dll)

If Msgbox(262161,$Title," RESTORE sSentryini..") = 1 Then

Run("sSInstall.exe", @ScriptDir)

Exit

EndIf

EndIf

If _IsPressed('11', $dll) And _IsPressed('23', $dll) Then ; Ctrl + End to Close Skype

DllClose($dll)

If Msgbox(262161,$Title," CLOSE Skype..") = 1 Then

$PID = ProcessExists("Skype.exe")

If $PID Then ProcessClose($PID)

EndIf

EndIf

EndFunc ;==>KeysMonitor

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