User Tools

Site Tools


using_autohotkey_to_make_a_second_mouse_into_a_multimedia_control

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
using_autohotkey_to_make_a_second_mouse_into_a_multimedia_control [2012/11/05 19:23] tkbletscusing_autohotkey_to_make_a_second_mouse_into_a_multimedia_control [2012/11/05 19:25] (current) tkbletsc
Line 15: Line 15:
   - If the target mouse sent the event, then we (1) squelch the next mouse event that would be caught by the normal Windows event system, and (2) send another key sequence instead.   - If the target mouse sent the event, then we (1) squelch the next mouse event that would be caught by the normal Windows event system, and (2) send another key sequence instead.
   - Mouse squelching is done by hooking all the button events using normal AutoHotKey syntax, then forwarding the event if and only if squelch_mouse is off.  If squelch_mouse is on, it is turned off by the event, so subsequent clicks WILL be received (e.g. from the regular mouse).   - Mouse squelching is done by hooking all the button events using normal AutoHotKey syntax, then forwarding the event if and only if squelch_mouse is off.  If squelch_mouse is on, it is turned off by the event, so subsequent clicks WILL be received (e.g. from the regular mouse).
 +
 +This supresses the button events -- to supress the cursor movement, I suggest masking tape.
 +
  
 <code> <code>
-; ===== START aux mouse multimedia control ===== 
 ; === Using AutoHotkey to make a second mouse into a multimedia control === ; === Using AutoHotkey to make a second mouse into a multimedia control ===
 +;
 ; Using a rather fancy AutoHotKey recipe, we can use an extra mouse hooked to the system  ; Using a rather fancy AutoHotKey recipe, we can use an extra mouse hooked to the system 
 ; to act as a multimedia report (or whatever we want). This is a bit tricky, since  ; to act as a multimedia report (or whatever we want). This is a bit tricky, since 
 ; Windows treats all mice as the same by default. To get around this, we use the  ; Windows treats all mice as the same by default. To get around this, we use the 
 ; Microsoft API for raw input. ; Microsoft API for raw input.
 +;
 ; This was inspired by (and somewhat copied from) EitherMouse and this guy's forum post.  ; This was inspired by (and somewhat copied from) EitherMouse and this guy's forum post. 
 ; Note that this does NOT use Michael Simon's AutoHotKey HID support package. ; Note that this does NOT use Michael Simon's AutoHotKey HID support package.
 +;
 ; To use, install the code below in AutoHotKey. Press Ctrl+Win+M then wiggle/click the  ; To use, install the code below in AutoHotKey. Press Ctrl+Win+M then wiggle/click the 
-; "target mouse" to find out its name. Plug the name into line 3. You can then change  +; "target mouse" to find out its name. Plug the name into the 'target_mouse' line. You  
-what each button does by editing the Send commands on lines 84-111+can then change what each button does by editing the Send commands in WM_INPUT
 +;
 ; The code works by: ; The code works by:
 +;
 ; 1. Hooking all mouse events into WM_INPUT via RegisterRawInputDevices API. ; 1. Hooking all mouse events into WM_INPUT via RegisterRawInputDevices API.
- 
 ; 2. Using the GetRawInputData to get the call detail, and GetRawInputDeviceInfo to find the  ; 2. Using the GetRawInputData to get the call detail, and GetRawInputDeviceInfo to find the 
 ;    name of the mouse responsible. ;    name of the mouse responsible.
- 
 ; 3. If the target mouse sent the event, then we (1) squelch the next mouse event that would  ; 3. If the target mouse sent the event, then we (1) squelch the next mouse event that would 
 ;    be caught by the normal Windows event system, and (2) send another key sequence instead. ;    be caught by the normal Windows event system, and (2) send another key sequence instead.
- 
 ; 4. Mouse squelching is done by hooking all the button events using normal AutoHotKey syntax,  ; 4. Mouse squelching is done by hooking all the button events using normal AutoHotKey syntax, 
 ;    then forwarding the event if and only if squelch_mouse is off. If squelch_mouse is on, ;    then forwarding the event if and only if squelch_mouse is off. If squelch_mouse is on,
 ;    it is turned off by the event, so subsequent clicks WILL be received (e.g. from the  ;    it is turned off by the event, so subsequent clicks WILL be received (e.g. from the 
 ;    regular mouse). ;    regular mouse).
- +; 
 +; This supresses the button events -- to supress the cursor movement, I suggest masking tape. 
 +;
 RegisterRawInputDevice(1, 2, A_ScriptHWnd) ; Listen to all mouse events RegisterRawInputDevice(1, 2, A_ScriptHWnd) ; Listen to all mouse events
  
using_autohotkey_to_make_a_second_mouse_into_a_multimedia_control.txt · Last modified: 2012/11/05 19:25 by tkbletsc

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki