r1se 0 Posted February 25, 2011 Hey ! i want to hold f to activate my script, when i release the button f, the script should be paused. regards Share this post Link to post Share on other sites
Jos 2,213 Posted February 25, 2011 Hey ! i want to hold f to activate my script, when i release the button f, the script should be paused.regardsmmm second thread and not much progress.This is an AutoIt3 support forum, not a script request forum.So, start reading and researching first and come back when you have a real question.Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Share this post Link to post Share on other sites
Miniz 0 Posted February 25, 2011 (edited) Like Jos says, please search the forums or read the helpfile. But, have fun... GUICreate("Keypress example", 100, 40) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case -3 Exit EndSwitch If _IsPressed(46) Then ToolTip("Running", 0,0) Else ToolTip("Not Running", 0,0) EndIf WEnd Func _IsPressed($hexKey) $hexKey = DllCall("user32", "int", "GetAsyncKeyState", "int", '0x' & $hexKey) If Not @error And BitAND($hexKey[0], 0x8000) = 0x8000 Then Return 1 Return 0 EndFunc ;==>_IsPressed Edit: Typo. Edited February 25, 2011 by Miniz Share this post Link to post Share on other sites
Carlo84 2 Posted February 25, 2011 (edited) Hey ! i want to hold f to activate my script, when i release the button f, the script should be paused. regards Something like this i suppose. #include <Misc.au3> HotKeySet("f", "myFunction") While 1 Sleep(100) WEnd Func myFunction() If Not _IsPressed(46) Then Return While 1 If Not _IsPressed(46) Then Return ConsoleWrite("F is still pressed" & @LF) WEnd EndFunc ;==>myFunction EDIT: actually that one aborts... not pauses... Try this instead :-) #include <Misc.au3> HotKeySet("f", "myFunction") HotKeySet("{ESC}", "_Exit") While 1 Sleep(100) WEnd Func myFunction() While 1 _Pause() ;put this function before anything you do. ConsoleWrite("F is pressed" & @LF) Sleep(100) WEnd EndFunc ;==>myFunction Func _Pause() If Not _IsPressed(46) Then ConsoleWrite("F released" & @LF) While Not _IsPressed(46) Sleep(100) WEnd EndFunc ;==>_Pause Func _Exit() Exit EndFunc ;==>_Exit Edited February 25, 2011 by Djarlo _SplashProgressImage | _Regionselector | _IsPressed360 | _UserAccountContol_SetLevel | _ListSubFolders Share this post Link to post Share on other sites