Search the Community
Showing results for tags 'press'.
-
Exit function from "outsite" with button press
Comboku posted a topic in AutoIt GUI Help and Support
Hi Guys, I have written a little loop program that counts to whatever you choose in "Rounds". (this is just a short version of my program, but it should cover what I try to achieve) I now want to be able to stop the counting by pressing the start/stop button. Unfortunately, autoit only registers my click on my button AFTER the func has ended. Do you guys have an idea how to stop the function? Maybe check if button was pressed in the loop? Thanks, Comboku #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <IE.au3> #include <Array.au3> #include <File.au3> $Form1 = GUICreate("Looper", 355, 229, 435, 293) $StartStop = GUICtrlCreateButton("Start", 136, 184, 75, 25) $Rounds = GUICtrlCreateInput("1", 210, 40, 80, 21) $lRounds = GUICtrlCreateLabel("Rounds", 298, 42, 52, 18) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $StartStop If GUICtrlRead($StartStop) = "Start" Then GUICtrlSetData($StartStop, "Stop") GUICtrlSetState($Rounds, $GUI_DISABLE) Call("Loop") ElseIf GUICtrlRead($StartStop) = "Stop" Then ExitLoop MsgBox(0, "Info", "Stopped") Else MsgBox(0, "Info", "Error") EndIf Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func Loop() $LoopTimes = GUICtrlRead($Rounds) For $i = 1 To $LoopTimes MsgBox(0, "Info", "LET US COUNT: " & $i) Sleep("2000") Next GUICtrlSetData($StartStop, "Start") GUICtrlSetState($StartStop, $GUI_ENABLE) GUICtrlSetState($Rounds, $GUI_ENABLE) EndFunc -
IsPressed_UDF is based on original _IsPressed function. Description : -This udf can detect if some keys are pressed by user on keyboard or mouse. -IsPressed functions extend possibility to choice keys to check. -Keys are specified in functions by their hexadecimal number, ['0D' = 'ENTER'] you can also translate hexadecimal key to alpha key (see functions and examples) Update : [Latest: 12 Jun 2013] Functions : Exemples : IsPressed_UDF 2.3 : IsPressed_UDF.au3 IsPressed_UDF 2.2 : IsPressed_UDF.au3 Add IsPressed_UDF functions to SciTE : IsPressed_Function Enjoy !
- 104 replies
-
- _ispressed
- key
-
(and 2 more)
Tagged with:
-
Hello! Do anyone know a simple program, a website, or perhaps a simple AutoIt script to achieve the following: When i press [Enter], ".", or any othey key, I want to see for how long that specific key is pressed down. This should generally be a very low number, a few milliseconds perhaps. I want to measure this with precision. Later on I want to measure mouse clicks as well (down time), but I'd love to start look at keyboard data. Thanks in advance!