anixon Posted June 3, 2008 Share Posted June 3, 2008 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 More sharing options...
Richard Robertson Posted June 3, 2008 Share Posted June 3, 2008 Dim $result = MsgBox(0, "", "") If $result = ... Then ... Link to comment Share on other sites More sharing options...
enaiman Posted June 3, 2008 Share Posted June 3, 2008 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. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
anixon Posted June 3, 2008 Author Share Posted June 3, 2008 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 treatLocal $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 ;CancelEndSelectmsgbox(0,"",$iMBAns) Link to comment Share on other sites More sharing options...
anixon Posted June 3, 2008 Author Share Posted June 3, 2008 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 More sharing options...
ChrisL Posted June 3, 2008 Share Posted June 3, 2008 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 [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
anixon Posted June 3, 2008 Author Share Posted June 3, 2008 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") EndIfWow three different ways to do it that's cool. Thanks for the input Link to comment Share on other sites More sharing options...
Richard Robertson Posted June 3, 2008 Share Posted June 3, 2008 Well, friend, it's programming. I have rarely seen a process that can only be done one way. If you want another way to do a message box, you could write your own GUI code. But that's getting over-the-top. Link to comment Share on other sites More sharing options...
anixon Posted June 4, 2008 Author Share Posted June 4, 2008 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now