comment out the line containing "scroll_Hotkey = !RButton"
no idea about the other question
Mouse Wheel Emulator
Started by
Blahman
, Oct 18 2009 08:12 AM
24 replies to this topic
#16
-
Posted 08 January 2011 - 05:24 AM
hi
i used your zipfile! running the script works .. when i press both mouse buttons the mouse stops moving like expected but when i start moving the mouse no scroll event is sent to the active window..
i use win 7 x64 .. any ideas?
thx
m
i used your zipfile! running the script works .. when i press both mouse buttons the mouse stops moving like expected but when i start moving the mouse no scroll event is sent to the active window..
i use win 7 x64 .. any ideas?
thx
m
#17
-
Posted 04 May 2011 - 10:26 AM
Have you read through the script particularly the section about the different scroll modes? You will likely need to try a few things on your own.
#18
-
Posted 04 May 2011 - 11:48 PM
Hi Blahman,
first, your script is phantastic! I use it for a trackball, and it turns it into a phantastic scrolling device.
I just would like to use it with either
1. only keyboard (LWin)
2. or only the right mouse button
1. doesn't work reliably, often the button reactivates itself when i release it - it ist the same with all buttons.
2. the problem is that I cannot pass trough the right mouse button for the applacation. I tried to pass is with Send{RButton} if the mouse didn't move, but that doesn't work in all applications.
Do you have any ideas, how to make one of these cases working? Would be really great - because !RButton is a little annoying...
Thanks in advance
Andreas
first, your script is phantastic! I use it for a trackball, and it turns it into a phantastic scrolling device.
I just would like to use it with either
1. only keyboard (LWin)
2. or only the right mouse button
1. doesn't work reliably, often the button reactivates itself when i release it - it ist the same with all buttons.
2. the problem is that I cannot pass trough the right mouse button for the applacation. I tried to pass is with Send{RButton} if the mouse didn't move, but that doesn't work in all applications.
Do you have any ideas, how to make one of these cases working? Would be really great - because !RButton is a little annoying...
Thanks in advance
Andreas
#19
-
Posted 21 November 2011 - 02:42 PM
Hey Blahman!
I've used your script for a few days now, and it's very nice; much appreciated.
In use I discovered a few things that were amiss or not functioning as well as I'd like, and changed those. You can see what in the script and comments below.
Most important things would be: I've added to Mode 0 the possibitility of horizontal scroll, through usage of {WheelRight} and Left; I'm guessing that has been added to autohotkey after you wrote this script.
And an on/off toggle because I noticed it did interfere with some games; the mouse would just randomly shoot up.
Thanks again for this script, really helps make a trackball in a keyboard useful!
I've used your script for a few days now, and it's very nice; much appreciated.
In use I discovered a few things that were amiss or not functioning as well as I'd like, and changed those. You can see what in the script and comments below.
Most important things would be: I've added to Mode 0 the possibitility of horizontal scroll, through usage of {WheelRight} and Left; I'm guessing that has been added to autohotkey after you wrote this script.
And an on/off toggle because I noticed it did interfere with some games; the mouse would just randomly shoot up.
Thanks again for this script, really helps make a trackball in a keyboard useful!
;; MouseWheelEmulator.ahk /* MouseWheelEmulator Created by Blahman (blah238 at gmail dot com) v1.0 10/18/2009 Summary: This script combines the functionality of TheGood's AHKHID and ManaUser's MakeChord libraries to provide emulated middle-click and scroll wheel abilities to users of mice, trackpads and trackballs without a scroll wheel. Features: -Allows middle clicks and mouse wheel scrolling to be performed on hardware without a physical scroll wheel -Freezes the mouse cursor in place during virtual mouse wheel scrolling -Sends scroll wheel messages to window or control under cursor, not just the active window (in supported applications; see note about different scroll modes below) Installation: 1) Download the AHKHID and MakeChord libraries and place the AHKHID.ahk and MakeChord.ahk files in the same folder as this script. AHKHID: http://www.autohotkey.com/forum/topic41397.html MakeChord (just the second half that starts with the MakeChord() function): http://www.autohotkey.com/forum/topic44399.html 2) Run this script. Usage: By default there are two ways to activate a middle click or scroll the virtual mouse wheel: To perform middle-click: Click the left and right mouse buttons simultaneously (often referred to as "chording"). -or- Hold Alt and right click. ;Changed to: press numpad5 while numlock is off. To scroll the virtual mouse wheel: Click and hold the left and right mouse buttons simultaneously and move the mouse in the direction you wish to scroll. -or- Hold Alt, click and hold the right mouse button, and move the mouse in the direction you wish to scroll. ;Changed to: hold numpad5 while numlock is off, drag mouse to scroll. Note: If you need to terminate the script you can use Ctrl-Alt-Break. About the different scroll modes: There are several different ways that any given program may implement mouse scrolling. AHK has built-in WheelUp and WheelDown functions, but not all applications respond to them. Some applications respond to WM_VSCROLL/WM_HSCROLL messages, while others respond to WM_MOUSEWHEEL/WM_HSCROLL messages. If you find an application you use doesn't work with this script out of the box, you can probably fix it yourself by adding that application's process name to the conditional statements in the GetScrollMode() function. The default scroll mode, 0, is AHK's built-in WheelUp and WheelDown commands. This does not support horizontal scrolling or scrolling the window or control under the cursor, while the other two modes do. Some applications respond to more than one scroll mode, so you can try them all and decide which works best for you. Finally, to further muddy the waters, some applications have frames within them that respond to scroll messages differently to the rest of the application. An example of this is the AHK help file, which uses the Internet Explorer_Server1 control to display HTML pages in one frame, and standard Windows controls to display the table of contents, index, etc. in another frame, and each responds to different scroll modes. I have tried to account for this in the GetScrollMode() function as well, but there may be other implementations I have not covered. You can use AHK's Window Spy to determine the name of the non-conforming control and write an exception for it, similar to the examples I have provided. ;Now in 1.0+ the default mode 0 does support left and right scrolling. |[warning] it's advisable to disable during games, otherwise it might cramp your style. |v1.0+ mini-edit, april 2012 |-Added WheelRight/Left to mode 0 |-Added scrolllock as on/off toggle, to disable in games; light on = disabled. |-Dropped priority and critical, way less unreliable now (for me at least) |-Changed mouse_threshold to 2 from 3 |-Renamed mouse_moved variable contents from n/y to no/yes to avoid confusion with 'y' variable used |-Moved firefox from mode 2 to 0, and added notepad++ to mode 1 |and everyone for sharing scripts and knowledge. */ ;; Configuration mouse_Threshold = 2 ;3 ; the number of pixels the mouse must move for a scroll tick to occur ; ^ don't put the ; right next to the active number. will get added to the var otherwise, givingg problems. MakeChord("LButton", "RButton", "scrollChord", 20) ; Chord to activate middle click or scrolling. See MakeChord.ahk for instructions scroll_Hotkey = NumpadClear ;is numpad5 w numlock off ;!RButton ; Hotkey to activate middle click or scrolling ;; End Configuration #SingleInstance Force #NoEnv #Persistent SendMode Input Process, Priority, , High ;Realtime #Include %A_ScriptDir%\AHKHID.ahk ;Create GUI to receive messages Gui, +LastFound hGui := WinExist() ;Intercept WM_INPUT messages OnMessage(0x00FF, "InputMsg") SetDefaultMouseSpeed, 0 scrollMode = 0 ; 0 = MouseClick, WheelUp/WheelDown, 1 = WM_VSCROLL/WM_HSCROLL, 2 = WM_MOUSEWHEEL/WM_HSCROLL CoordMode, Mouse, Screen HotKey, %scroll_Hotkey%, scrollChord HotKey, %scroll_Hotkey% Up, scrollChord_Up return scrollChord: mouse_Moved = no BlockInput, MouseMove MouseGetPos, m_x, m_y, winID, control WinGet, procName, ProcessName, ahk_id %winID% hw_m_target := DllCall( "WindowFromPoint", "int", m_x, "int", m_y ) GetScrollMode() HID_Register(1, 2, hGui, RIDEV_INPUTSINK) return scrollChord_Up: ToolTip BlockInput, MouseMoveOff HID_Register(1,2,0,RIDEV_REMOVE) if mouse_Moved = no MouseClick, Middle return InputMsg(wParam, lParam) { local x, y ;Critical x := HID_GetInputInfo(lParam, II_MSE_LASTX) y := HID_GetInputInfo(lParam, II_MSE_LASTY) If ((Abs(x) > 0.0) or (Abs(y) > 0.0)) mouse_Moved = yes if y > %mouse_Threshold% { ScrollDown() } else if y < -%mouse_Threshold% { ScrollUp() } if x > %mouse_Threshold% { ScrollRight() } else if x < -%mouse_Threshold% { ScrollLeft() } ;ToolTip, % "dX = " . x . " " . "dY = " . y . a_tab . winID . a_tab . control . a_tab . procName . a_tab . hw_m_target . a_tab . scrollMode ;; Uncomment the above line for handy debug info shown while scrolling } GetScrollMode() { global local ctl_x, ctl_y, ctl_w, ctl_h, ctl_hwnd, win_x, win_y if (procName = "notepad++.exe" or procName = "hh.exe" or procName = "iexplore.exe" or procName = "dexplore.exe" or procName = "OUTLOOK.EXE") { scrollMode = 1 WinGetPos, win_x, win_y, , , ahk_id %WinID% ControlGetPos, ctl_x, ctl_y, ctl_w, ctl_h, Internet Explorer_Server1, ahk_id %WinID% if (((m_x >= win_x + ctl_x) and (m_x <= win_x + ctl_x + ctl_w)) and ((m_y >= win_y + ctl_y) and (m_y <= win_y + ctl_y + ctl_h))) control = Internet Explorer_Server1 else { ControlGetPos, ctl_x, ctl_y, ctl_w, ctl_h, NETUIHWND1, ahk_id %WinID% if (((m_x >= win_x + ctl_x) and (m_x <= win_x + ctl_x + ctl_w)) and ((m_y >= win_y + ctl_y) and (m_y <= win_y + ctl_y + ctl_h))) scrollMode = 2 } } else if (procName = "notepad.exe" or procName = "explorer.exe" or procName = "EXCEL.exe") ;firefox.exe scrollMode = 2 else ;firefox.exe scrollMode = 0 return } ScrollDown() { global if (scrollMode = 0) MouseClick, WheelDown else if (scrollMode = 1) PostMessage, 0x115, 1, 0, %control%, ahk_id %winID% else { ; WM_MOUSEWHEEL ; WHEEL_DELTA = 120 PostMessage, 0x20A, -120 << 16, ( m_y << 16 )|m_x,, ahk_id %hw_m_target% } } ScrollUp() { global if (scrollMode = 0) MouseClick, WheelUp else if (scrollMode = 1) PostMessage, 0x115, 0, 0, %control%, ahk_id %winID% else if (scrollMode = 2) { ; WM_MOUSEWHEEL ; WHEEL_DELTA = 120 PostMessage, 0x20A, 120 << 16, ( m_y << 16 )|m_x,, ahk_id %hw_m_target% } } ScrollRight() { global if (scrollMode = 0) MouseClick, WheelRight ;Send {WheelRight} else if (scrollMode <> 0) ;loop, 2 SendMessage, 0x114, 1, 0, %control%, ahk_id %winID% } ScrollLeft() { global if (scrollMode = 0) MouseClick, WheelLeft ;Send {WheelLeft} else if (scrollMode <> 0) ;loop, 2 SendMessage, 0x114, 0, 0, %control%, ahk_id %winID% } ^!CtrlBreak::ExitApp ~ScrollLock::Suspend, Toggle ;~ is so the light and function will still trigger; you can now tell that this script is disabled when the light is on. #Include %A_ScriptDir%\MakeChord.ahk
#20
-
Posted 24 April 2012 - 07:56 PM
Many mice separate are tops from their bottoms by grasping the top half firmly and sliding the bottom forward with a little effort. Sometimes using are a screwdriver as a lever helps, just don't overforce things. There are small tab thingys that hold things together that must be overcome.
#21
-
Posted 28 April 2012 - 10:11 AM
Sorry for thread pushing, but the file isnt downloadable and I really could need a emulator, because my wheel is not working anymore.
Greetings
Greetings
#22
-
Posted 02 September 2012 - 10:36 AM
I have fixed the broken link and also added a link to the precompiled executable.
#23
-
Posted 08 August 2015 - 06:25 AM
Could you please explain to me how to remap the chord key? I prefer to use one button (XButton1) than use two button. I tried remapping it by writing another script but it didn't work.
#24
-
Posted 28 August 2015 - 08:58 AM
Could you please explain to me how to remap the chord key? I prefer to use one button (XButton1) than use two button. I tried remapping it by writing another script but it didn't work.
Not sure what you did, but try changing line 51 to `scroll_Hotkey = Xbutton1`. If that doesn't work then sorry I have no idea.
#25
-
Posted 31 August 2015 - 08:47 AM