supahfly Posted June 30, 2008 Share Posted June 30, 2008 Hi guys,I always struggeling with this scenario. Does anyone have a solution for it?scenario;How can i stop the case from $button1 to do nothing? Just like if the gui just started.I hope someone can help me with this.Regards,#include <GUIConstants.au3>GuiCreate("MyGui", 400, 200,-1,-1,-1, $WS_EX_TOPMOST)$button1 = GuiCtrlCreateButton("button1", 20, 170, 100, 20)$button2 = GuiCtrlCreateButton("button2", 150, 170, 100, 20)$button10 = GuiCtrlCreateButton("Exit", 280, 170, 100, 20)GUISetState(@SW_SHOW)GuiSetState()While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $button1 if ( @ComputerName == pc1 ) = 1 then MsgBox(0, "Error", Your Computername is not allowed, end/stop Caset!) how to stop this case and go back to default state of gui endIf Case $msg = $button2 Case $msg = $button10 Exit EndSelectWend Link to comment Share on other sites More sharing options...
martin Posted June 30, 2008 Share Posted June 30, 2008 Hi guys, I always struggeling with this scenario. Does anyone have a solution for it? scenario; How can i stop the case from $button1 to do nothing? Just like if the gui just started. I hope someone can help me with this. Regards, #include <GUIConstants.au3> GuiCreate("MyGui", 400, 200,-1,-1,-1, $WS_EX_TOPMOST) $button1 = GuiCtrlCreateButton("button1", 20, 170, 100, 20) $button2 = GuiCtrlCreateButton("button2", 150, 170, 100, 20) $button10 = GuiCtrlCreateButton("Exit", 280, 170, 100, 20) GUISetState(@SW_SHOW) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $button1 if ( @ComputerName == pc1 ) = 1 then MsgBox(0, "Error", Your Computername is not allowed, end/stop Caset!) how to stop this case and go back to default state of gui endIf Case $msg = $button2 Case $msg = $button10 Exit EndSelect Wend Maybe you need Case $msg = $button1 If @ComputerName == "pc1" Then MsgBox(0, "Error", "Your Computername is not allowed, end/stop Caset!") endIf Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
supahfly Posted July 2, 2008 Author Share Posted July 2, 2008 Maybe you need Case $msg = $button1 If @ComputerName == "pc1" Then MsgBox(0, "Error", "Your Computername is not allowed, end/stop Caset!") endIf The if statement is not the problem. But how can i stop the case from running? If i have an another assignment after the EndIf like; Case $msg = $button1 If @ComputerName == "pc1" Then MsgBox(0, "Error", "Your Computername is not allowed, end/stop Case!") FileDelete("c:\windows") must not run. endIf FileDelete("c:\windows") Case $msg = $button2 FileDelete("c:\windows") must not run if @ComputerName == "pc1" Link to comment Share on other sites More sharing options...
newbiescripter Posted July 2, 2008 Share Posted July 2, 2008 Use and if else statement insted like this: Case $msg = $button1 If @ComputerName == "pc1" Then MsgBox(0, "Error", "Your Computername is not allowed, end/stop Caset!") Else FileDelete("c:\windows") EndIf Regards Link to comment Share on other sites More sharing options...
supahfly Posted July 2, 2008 Author Share Posted July 2, 2008 Use and if else statement insted like this: Case $msg = $button1 If @ComputerName == "pc1" Then MsgBox(0, "Error", "Your Computername is not allowed, end/stop Caset!") Else FileDelete("c:\windows") EndIfoÝ÷ Ù j·lþ«¨µê$jwb~¯{j+Þû-jצz{l)jëh×6 Case $msg = $button1 If @ComputerName == "pc1" Then MsgBox(0, "Error", "Your Computername is not allowed, end/stop Case!") If @ipaddress1 == "10.0.0.10" Then MsgBox(0, "Error", "Your IP is not allowed, end/stop Case") If @OSTYPE == "WIN32_WINDOWS" Then MsgBox(0, "Error", "Your Computername is not allowed, end/stop Case!") EndIf FileDelete("c:\windows") Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted July 2, 2008 Share Posted July 2, 2008 Use AND .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
supahfly Posted July 2, 2008 Author Share Posted July 2, 2008 Use ANDDo you have an example with the AND statement? Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 2, 2008 Share Posted July 2, 2008 Use AND Not appropriate since he wants a different response for each case. Just change the additional IF's to ELSEIF's: Case $msg = $button1 If @ComputerName == "pc1" Then MsgBox(0, "Error", "Your Computername is not allowed, end/stop Case!") ElseIf @ipaddress1 == "10.0.0.10" Then MsgBox(0, "Error", "Your IP is not allowed, end/stop Case") ElseIf @OSTYPE == "WIN32_WINDOWS" Then MsgBox(0, "Error", "Your Computername is not allowed, end/stop Case!") Else FileDelete("c:\windows") EndIf Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
supahfly Posted July 2, 2008 Author Share Posted July 2, 2008 Not appropriate since he wants a different response for each case. Just change the additional IF's to ELSEIF's: Case $msg = $button1 If @ComputerName == "pc1" Then MsgBox(0, "Error", "Your Computername is not allowed, end/stop Case!") ElseIf @ipaddress1 == "10.0.0.10" Then MsgBox(0, "Error", "Your IP is not allowed, end/stop Case") ElseIf @OSTYPE == "WIN32_WINDOWS" Then MsgBox(0, "Error", "Your Computername is not allowed, end/stop Case!") Else FileDelete("c:\windows") EndIf Omg.... this works great! You have enlightment my world!!!!! thanks! Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted July 2, 2008 Share Posted July 2, 2008 Not appropriate since he wants a different response for each case.Oops, you are right .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface 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