r1se Posted February 25, 2011 Share 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 Link to comment Share on other sites More sharing options...
Developers Jos Posted February 25, 2011 Developers Share 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. Link to comment Share on other sites More sharing options...
Miniz Posted February 25, 2011 Share 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 Link to comment Share on other sites More sharing options...
Carlo84 Posted February 25, 2011 Share 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 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