Use mouse movement as a switch action: AutoHotkey

This is a script that enables you to use your mouse or trackball as a switch, turning the movement into a click. If you move the mouse cursor anywhere on the screen, the movement will send a switch action. You might have to play with the pixel value in the script, or adjust the mouse speed or uncheck “enhance pointer precision” in Control Panel > Mouse depending on how steadily you move.

NOTE: If you use Virtual Keyboard, this script won’t help much unless you really fine tune it, because Virtual Keyboard requires the cursor to be over its “Sweep Click” box in order to use switch scanning. Nor will it work with Click N Type, because Click N Type immobilizes the cursor in Scan Mode. It will work with the Windows onscreen keyboard as long as you use a keyboard key to scan. The same would probably be true of commercial keyboards like WiViK or BeKey that can use the F11 and / or F12 keys for scanning. Just put the key in the script to suit yourself.

SendMode Input
CoordMode Mouse, Screen ;doesn’t matter where mouse cursor is
p=25 ;pixels mouse moves
WheelDown:: ; to start
Loop {
MouseGetPos x1,y1 ;original cursor position
Sleep,500 ;wait for keyboard to scan, set to keyboard’s scanning speed in milliseconds
MouseGetPos x2,y2 ;second cursor position
dx:= (x2-x1)//p, dy:= (y2-y1)//p ;distance; if distance is other than 0, indicates movement.
If dx>0
Send,{Space} ;or other scanning key or click
If dx<0
If dy>0
If dy<0

This entry was posted in Disability, Technology and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s