spuuunit Posted May 29, 2015 Share Posted May 29, 2015 (edited) I'm trying to make a script that detects if I double click or double tap a key. This is the closest I get, when I double tap "P" (_IsPressed("50")). It only seems to work if I switch to different keys for some reason. #include <Misc.au3> $hDLL = DllOpen("user32.dll") $count = 0 While 1 If _IsPressed("50", $hDLL) Then While $count < 40 $count += 1 If _IsPressed("50", $hDLL) Then MsgBox(0, "Double", "Double click / tap !") $count = 10000 EndIf Sleep(1) WEnd $count = 0 EndIf Sleep(1) WEndAny ideas how this can be done? For example, detect when I double tap "P". Edited May 29, 2015 by spuuunit Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 31, 2015 Moderators Share Posted May 31, 2015 Your question is a bit vague - double click where? on what? If, for example, you want to detect a double click on a GUI button, you would do something like this:If you're looking more for capturing a double click in a specific area like an input field, you may try something like this:If those don't help, perhaps you could provide more information on exactly what you are trying to do, along with what you have tried on your own already. As an aside, these threads, along with many, many others, were brought up through a relatively simply forum search. You should always do such a search before posting a question. 232showtime 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
spuuunit Posted May 31, 2015 Author Share Posted May 31, 2015 I'm sorry I didn't cleared that out - I'm tying to capture it anywhere, allways. I tried the examples in the links, but since they're only for a self created interface, it's not what I'm looking for. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 31, 2015 Moderators Share Posted May 31, 2015 spuuunit,This works for me:#include <Misc.au3> #include <MsgBoxConstants.au3> HotKeySet("{ESC}", "_Exit") $iPeriod = 100 ; Set limit for double tap interval $hDLL = DllOpen("user32.dll") While 1 ; If "p" pressed If _IsPressed("50", $hDLL) Then ; Wait for it to be released While _IsPressed("50", $hDLL) Sleep(10) WEnd ; Start a timer $nBegin = TimerInit() ; Wait for set period Do ; If pressed again If _IsPressed("50", $hDLL) Then MsgBox($MB_SYSTEMMODAL, "Hi", "Double tap") ExitLoop EndIf Sleep(10) Until TimerDiff($nBegin) > 100 EndIf WEnd Func _Exit() Exit EndFuncBut if you want to expand it to look for more keys, please read this announcement before posting any code:I know it is not what you are doing, but the restriction still applies.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
spuuunit Posted May 31, 2015 Author Share Posted May 31, 2015 Thanks Melba23, works like a charm. 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