DarkAngelBGE Posted March 24, 2007 Share Posted March 24, 2007 Hi all, I am making a simple script that detects, whether the shift key is held down and for how long... When I try _IsPressed I cannot differentiate between the shift key being held down or if it has just been released. Is there any way to do this? Thanks for your support! Link to comment Share on other sites More sharing options...
jvanegmond Posted March 24, 2007 Share Posted March 24, 2007 (edited) MouseHook by Larry. Perfect.Edit: Or if you want to know whether it is released now.. Just use "If Not _IsPressed" Edited March 24, 2007 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
DarkAngelBGE Posted March 24, 2007 Author Share Posted March 24, 2007 Nah, I need to catch the exact moment. Nevermind, found out using GetKeyState of the user32.dll. Link to comment Share on other sites More sharing options...
jvanegmond Posted March 24, 2007 Share Posted March 24, 2007 Good solution. github.com/jvanegmond Link to comment Share on other sites More sharing options...
dabus Posted March 24, 2007 Share Posted March 24, 2007 (edited) This would work, too. #include <Misc.au3> $var=11 If _IsPressed($var) Then While _IsPressed($var) Sleep(10) WEnd MsgBox(0, 'Botton', 'released') EndIf Edited March 24, 2007 by dabus Link to comment Share on other sites More sharing options...
Toady Posted March 24, 2007 Share Posted March 24, 2007 Func GetKeyState($VK_Code) Local $a_Return = DllCall("user32.dll","short","GetKeyState","int",$VK_Code) If $a_Return[0] < -126 Then Return 1 ;Key is pressed Else Return 0 ;Key is released EndIf EndFunc www.itoady.com A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding 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