Klovis Posted June 28, 2011 Share Posted June 28, 2011 So I want this gui to send me a msgbox but only if the slider is between the numbers 10 and 20 right now I have it so if the $v is greater then 10 but smaller then 20 it should work but it doesn't why and how do i fix it? #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <SliderConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 151, 93, 192, 114) $Slider1 = GUICtrlCreateSlider(0, 16, 150, 45) GUICtrlSetLimit($Slider1,30,0) $hSlider = GUICtrlGetHandle($Slider1) $Button1 = GUICtrlCreateButton("Button1", 40, 64, 75, 25, $WS_GROUP) $Label1 = GUICtrlCreateLabel("0", 64, 0, 30, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GUIRegisterMsg($WM_HSCROLL, "hscroll") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $v = GUICtrlRead($Slider1) If 10<$v<20 Then MsgBox(0,"test", "sucsess") ElseIf @error Then MsgBox(0, "test", "faliure") EndIf EndSwitch WEnd Func hscroll($hWnd, $iMsg, $iwParam, $ilParam) $v = GUICtrlRead($Slider1) If $ilParam = $hSlider Then GUICtrlSetData($Label1, $v) EndIf EndFunc Link to comment Share on other sites More sharing options...
GEOSoft Posted June 28, 2011 Share Posted June 28, 2011 (edited) Look at it again and think of the logic then try it this way. If $v >10 AND $v <20 Then Edited June 28, 2011 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Klovis Posted June 28, 2011 Author Share Posted June 28, 2011 Haha and I was saying that code in my head as I was typing my pathetic code, thanks man! 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