Вы находитесь на странице: 1из 4

TouchFreeze alternative in AHK Productive Geek Forums

http://productivegeek.com/forums/topic/touchfreeze-alternative-in-ahk 5 captures
25 Feb 10 - 15 Sep 10

Page 1
Go APR AUG

16
2009 2010

Login / Signup Productive Geek Forums Lifehacker Coders

TouchFreeze alternative in AHK


started 5 months ago | 4 posts | 32387 views | topic rss | latest reply

1. A few months back, LH posted a link to TouchFreeze: http://lifehacker.com/5412986/touchfreeze-disables-your-touchpad-as-soon-as-youstart-typing This program was designed to stop you from accidentally hitting your laptop/netbook's trackpad with your thumbs while you are typing. However, this program didn't really work for me - I still accidentally jumped the cursor from time-to-time. So here's my Autohotkey version, which has been working very well for me for the last couple of weeks since I created it. (Note that you can tweak the timer line if the 500ms default still isn't quite long enough for you.) I've noticed no performance lag at all with method, since it's a keyboard hook. I think it's always better to add little functions like these to my AHK master script, rather than installing YAU (yet another utility) for these small tweaks.
; Script Function: ; Disables trackpad for 500ms any time a key is pressed (prevents accidental mouse clicks) ; #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.

http://web.archive.org/web/20100816043532/http://productivegeek.com/forums/topic/touchfreeze-alternative-in-ahk

12-06-2012 19:53:32

TouchFreeze alternative in AHK Productive Geek Forums


#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. http://productivegeek.com/forums/topic/touchfreeze-alternative-in-ahk SendMode Input ; Recommended for new scripts due to its superior speed and reliability. 5 SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
captures Go

Page 2

APR

AUG

;keyboard hook code credit: #Persistent OnExit, Unhook

25 Feb 10 http://www.autohotkey.com/forum/post-127490.html#127490 - 15 Sep 10

16
2009 2010

hHookKeybd := SetWindowsHookEx(WH_KEYBOARD_LL Return ReenableTrackpad: BlockInput, MouseMoveOff Return Unhook: UnhookWindowsHookEx(hHookKeybd) ExitApp Keyboard(nCode, wParam, lParam) { Critical If !nCode { BlockInput, MouseMove SetTimer, ReenableTrackpad, 500 } Return CallNextHookEx(nCode, wParam, lParam) }

:= 13, RegisterCallback("Keyboard", "Fast"))

SetWindowsHookEx(idHook, pfn) { Return DllCall("SetWindowsHookEx", "int", idHook, "Uint", pfn, "Uint", DllCall("GetModuleHandle", "Uint", 0), "Uint", 0) } UnhookWindowsHookEx(hHook) { Return DllCall("UnhookWindowsHookEx", "Uint", hHook) } CallNextHookEx(nCode, wParam, lParam, hHook = 0) { Return DllCall("CallNextHookEx", "Uint", hHook, "int", nCode, "Uint", wParam, "Uint", lParam) }

# 2. New version 1.1! Thanks to all you Lifehackers who offered your suggestions!
; v1.0 2010-02-23 Original Release ; v1.1 2010-02-25 Added user configuration section ; Added option to block mouse clicks ; Added option to omit blocking for shift, ctrl, alt, win keys #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. ;user configuration DisableTime := 500 ;in milliseconds BlockMouseMove := True BlockLeftClick := True BlockMiddleClick := True BlockRightClick := True AllowShift := True AllowCtrl := True AllowAlt := True AllowWin :=True ;keyboard hook code credit: http://www.autohotkey.com/forum/post-127490.html#127490 #Persistent OnExit, Unhook ;initialize hHookKeybd := SetWindowsHookEx(WH_KEYBOARD_LL Hotkey, LButton, DoNothing, Off Hotkey, MButton, DoNothing, Off Hotkey, RButton, DoNothing, Off Return

bobbo33
Reputation:24 Posted 5 months ago

:= 13, RegisterCallback("Keyboard", "Fast"))

DisableTrackpad: ShiftActive := AllowShift && GetKeyState("Shift") CtrlActive := AllowCtrl && GetKeyState("Ctrl")

http://web.archive.org/web/20100816043532/http://productivegeek.com/forums/topic/touchfreeze-alternative-in-ahk

12-06-2012 19:53:32

TouchFreeze alternative in AHK Productive Geek Forums


CtrlActive := AllowCtrl && GetKeyState("Ctrl") http://productivegeek.com/forums/topic/touchfreeze-alternative-in-ahk AltActive := AllowAlt && GetKeyState("Alt") 5 LWinActive := AllowWin && GetKeyState("LWin") captures RWinActive := AllowWin && GetKeyState("RWin") 25 Feb 10 if (!ShiftActive && !CtrlActive && !AltActive && - 15 !LWinActive && !RWinActive) Sep { 10 if (BlockMouseMove) BlockInput, MouseMove if (BlockLeftClick) Hotkey, LButton, DoNothing, On if (BlockMiddleClick) Hotkey, MButton, DoNothing, On if (BlockLeftClick) Hotkey, RButton, DoNothing, On } Return ReenableTrackpad: if (BlockMouseMove) BlockInput, MouseMoveOff if (BlockLeftClick) Hotkey, LButton, Off if (BlockMiddleClick) Hotkey, MButton, Off if (BlockLeftClick) Hotkey, RButton, Off Return DoNothing: Return Unhook: UnhookWindowsHookEx(hHookKeybd) ExitApp Keyboard(nCode, wParam, lParam) { Critical If !nCode { Gosub, DisableTrackpad SetTimer, ReenableTrackpad, %DisableTime% } Return CallNextHookEx(nCode, wParam, lParam) }
Go

Page 3

APR

AUG

16
2009 2010

SetWindowsHookEx(idHook, pfn) { Return DllCall("SetWindowsHookEx", "int", idHook, "Uint", pfn, "Uint", DllCall("GetModuleHandle", "Uint", 0), "Uint", 0) } UnhookWindowsHookEx(hHook) { Return DllCall("UnhookWindowsHookEx", "Uint", hHook) } CallNextHookEx(nCode, wParam, lParam, hHook = 0) { Return DllCall("CallNextHookEx", "Uint", hHook, "int", nCode, "Uint", wParam, "Uint", lParam) }

# 3. This works perfectly, thanks. One problem, though, I now can't play full screen games. Perhaps this might not actually be a problem, since I am now more productive without them :) # 4. What about disabling the touch pad but leaving the "eraser" style mouse active for those of us with Dell's that have both? Or at least increasing the delay on the touch pad but leaving the eraser mouse active all the time? I love Autohotkey scripts. thanks for the tool Alan darryn
Reputation:1 Posted 5 months ago

bobbo33
Reputation:24 Posted 5 months ago

http://web.archive.org/web/20100816043532/http://productivegeek.com/forums/topic/touchfreeze-alternative-in-ahk

12-06-2012 19:53:32

TouchFreeze alternative in AHK Productive Geek Forums


http://productivegeek.com/forums/topic/touchfreeze-alternative-in-ahk Go

Page 4

# You must log in to post.

5 captures
25 Feb 10 - 15 Sep 10

APR

AUG

asjones
Reputation:1 Posted 5 months ago
2009

16
2010

Daily Email Updates


Just want the best posts in your inbox for free? Enter your name and email below: Name:

Email

Subscribe!

About This Topic


Posted 5 months ago By bobbo33 Topic Views: 32387 Latest reply from asjones RSS feed for this topic

Tags
No tags yet.

Our Network
How-To Geek Sysadmin Geek TinyHacker

About Productive Geek


About Us Contact Us Copyright 2006-2010 HowToGeek.com. All Rights Reserved.

http://web.archive.org/web/20100816043532/http://productivegeek.com/forums/topic/touchfreeze-alternative-in-ahk

12-06-2012 19:53:32

Вам также может понравиться