AwAke Posted January 15, 2009 Share Posted January 15, 2009 (edited) Ok I want a function to, while the key 'A' or 'D' is pressed it will count the amount of miliseconds until the key is then released. After it gets the time I would then like to log it into a file. I have a script atm I just cant get out of the loop, all help is appreciated; #include <Misc.au3> Opt("WinTitleMatchMode", 4) $hwnd = WinGetHandle("classname=GxWindowClassD3d") $dll = DLLOpen("user32.dll") Global $start, $ExitLoop While 1 While _IsPressed("41" OR "44", $dll) $start = TimerInit() $ExitLoop = 1 WEnd If $ExitLoop = 1 Then ExitLoop EndIf Wend $end = TimerDiff($start) $file = FileOpen("C:\txt.txt", 1) Filewrite($file, $end) Edited January 15, 2009 by AwAke Link to comment Share on other sites More sharing options...
LimeSeed Posted January 15, 2009 Share Posted January 15, 2009 This should work, but only for the a key, im sure you can add the d key yourself #include "misc.au3" Dim $key = 0 Dim $dll = 'user32.dll' while (true) if (_IsPressed(41, $dll)) Then $long = TimerInit() while (_IsPressed(41, $dll)) $d = 1 WEnd $time = TimerDiff($long) msgbox(0, "long", "You pressed key for " & $time & " milliseconds") EndIf WEnd global $warming = true Link to comment Share on other sites More sharing options...
AwAke Posted January 15, 2009 Author Share Posted January 15, 2009 Wow, Ty mate. Perfect. Thats exactly what I wanted thanks alot Link to comment Share on other sites More sharing options...
LimeSeed Posted January 15, 2009 Share Posted January 15, 2009 Wow, Ty mate. Perfect. Thats exactly what I wanted thanks alot np global $warming = true 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