DonationCoder.com Software > Post New Requests Here
IDEA: ignore too early clicks
(1/1)
george_m6002:
I like having checked "Snap to" option for mouse (it avoids moving the mouse on the screen too much). But there is a bad point also: sometimes, a new dialog box can suddenly appear, the mouse automatically goes to default button (because of "snap to"), and you by mistake, wanting to click somewhere else, click on that button.
Is there a way to create a autohotkey script (or something else and would it be feasible) to ignore clicks that were made too early (=the difference between the moment the button appears on the screen and the moment the click was done is less than the time a human needs to make voluntarily this reaction)?
Thanks
jgpaiva:
I can understand what you mean. It must be very anoying.
Even though I can't present a solution for your problem, I suggest you check out my own DialogMove (discussed here). Instead of moving the mouse, it moves the dialog box that pops up.
If DialogMove fits you, I may add that delay to it (because with DialogMove, I control the window movement, thus I can disable the mouse button at just the right moment.)
skrommel:
:) Try WaitForIt!
It prevents accidental clicking on popup windows or when using "snap to" mouse settings.
To change the delay, just edit the delay= line in the code.
Skrommel
--- ---;WaitForIt.ahk
; Prevent accidental clicking on popup windows or when using "snap to" mouse settings
;Skrommel @ 2008
delay=1000 ;Time to wait in milliseconds
#SingleInstance,Force
SetWinDelay,0
Gui,+LastFound +OwnDialogs
hWnd:=WinExist()
DllCall("RegisterShellHookWindow",UInt,hWnd)
msgNum:=DllCall("RegisterWindowMessage", Str,"SHELLHOOK")
OnMessage(msgNum,"ShellMessage")
active:=WinActive("A")
OnExit,EXIT
Return
LBUtton::
MouseGetPos,mx,my,mwin,mctrl
If (mwin=active)
{
If (A_TickCount-activated>delay)
MouseClick,L,,,1,0,D,
}
Else
MouseClick,L,,,1,0,D,
Return
~LButton Up::
Return
ShellMessage(wParam,lParam)
{
Global active,activated,mwin,delay
If wParam=4 ;HSHELL_WINDOWACTIVATED=4 HSHELL_WINDOWCREATED=1
IfWinExist,ahk_id %lParam%
{
active:=lParam
activated:=A_TickCount
}
If (active=mwin)
activated:=A_TickCount-delay
}
EXIT:
DllCall( "DeregisterShellHookWindow", UInt,hWnd ) ; Redundant, I guess!
ExitApp
Navigation
[0] Message Index
Go to full version