TheBlackGamer Posted August 3, 2014 Posted August 3, 2014 I wonder How to Make An Incriment Code Each Time The Button Is Pressed It Adds 1 to A Label A tried This Code But it Didnot Do The Job ! #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 520, 247, 287, 270) $Input1 = GUICtrlCreateInput("Input1", 104, 48, 305, 21) $Button1 = GUICtrlCreateButton("Button1", 144, 144, 121, 33) GUICtrlSetOnEvent (-1 , 'Add') GUISetState(@SW_SHOW) HotKeySet("x", "add") #EndRegion ### END Koda GUI section ### Func Add () $Label1 = GUICtrlCreateLabel("0", 192, 96, 36, 17) $HLabel1 = GUICtrlRead($Label1) $hLabel1 += 1 GUICtrlSetData($Label1, $hlabel1 ) EndFunc While 1 Sleep(500) Wend
computergroove Posted August 4, 2014 Posted August 4, 2014 #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) $x = 0 #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 520, 247, 287, 270) $Input1 = GUICtrlCreateInput("Input1", 104, 48, 305, 21) $Button1 = GUICtrlCreateButton("Button1", 144, 144, 121, 33) GUICtrlSetOnEvent (-1 , 'Add') GUISetState(@SW_SHOW) HotKeySet("x", "add") #EndRegion ### END Koda GUI section ### Func Add () $Label1 = GUICtrlCreateLabel("0", 192, 96, 36, 17) $HLabel1 = GUICtrlRead($Label1) GUICtrlSetData($Label1, $x) $x = $x + 1 EndFunc While 1 Sleep(500) Wend Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html
TheBlackGamer Posted August 4, 2014 Author Posted August 4, 2014 #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) $x = 0 #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 520, 247, 287, 270) $Input1 = GUICtrlCreateInput("Input1", 104, 48, 305, 21) $Button1 = GUICtrlCreateButton("Button1", 144, 144, 121, 33) GUICtrlSetOnEvent (-1 , 'Add') GUISetState(@SW_SHOW) HotKeySet("x", "add") #EndRegion ### END Koda GUI section ### Func Add () $Label1 = GUICtrlCreateLabel("0", 192, 96, 36, 17) $HLabel1 = GUICtrlRead($Label1) GUICtrlSetData($Label1, $x) $x = $x + 1 EndFunc While 1 Sleep(500) Wend Thats It .... Damn I Need A cup of a Coffee or Get some Sleep (iTs 3.30 Am )
Werty Posted August 4, 2014 Posted August 4, 2014 Nah, your code works fine if you place the label creation further up, out of the func, so you dont create it every time the function is called, but only updates. Here #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 520, 247, 287, 270) $Input1 = GUICtrlCreateInput("Input1", 104, 48, 305, 21) $Label1 = GUICtrlCreateLabel("0", 192, 96, 36, 17) $Button1 = GUICtrlCreateButton("Button1", 144, 144, 121, 33) GUICtrlSetOnEvent (-1 , 'Add') GUISetState(@SW_SHOW) HotKeySet("x", "add") #EndRegion ### END Koda GUI section ### Func Add () $HLabel1 = GUICtrlRead($Label1) $hLabel1 += 1 GUICtrlSetData($Label1, $hlabel1 ) EndFunc While 1 Sleep(500) Wend Some guy's script + some other guy's script = my script!
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