topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday December 13, 2024, 4:03 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: IDEA: ignore too early clicks  (Read 4461 times)

george_m6002

  • Participant
  • Joined in 2008
  • *
  • default avatar
  • Posts: 1
    • View Profile
    • Donate to Member
IDEA: ignore too early clicks
« on: September 09, 2008, 06:22 AM »
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

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: IDEA: ignore too early clicks
« Reply #1 on: September 09, 2008, 04:36 PM »
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

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 933
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
Re: IDEA: ignore too early clicks
« Reply #2 on: September 23, 2008, 02:44 AM »
 :) 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