AutoHotkey Community

It is currently May 27th, 2012, 12:05 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 120 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8
Author Message
 Post subject: Re: @Scoox
PostPosted: March 16th, 2011, 1:02 pm 
Offline

Joined: November 28th, 2010, 8:37 am
Posts: 48
Location: Wuxi, China
Kelden wrote:
I use your version and it's really great.
But it doesn't work very well with a remote desktop connection.
I always get beeps. Do you know what it could be?


I assume that scrolling with a remote desktop connection works under normal circumstances (i.e. no script running), right?

First you could try jaco0646's simplified script above to see if that works. If you still experience problems they will be easier to track down as there is less code involved. Let us know :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 16th, 2011, 2:19 pm 
His version doesn't work. PostMessage doesn't work with remote desktop client.

Here is the version I use which doesn't beep.

Quote:
#NoEnv
CoordMode, Mouse, Screen

WheelUp::
WheelDown::
Critical
MouseGetPos, m_x, m_y
hw_m_target := DllCall( "WindowFromPoint", "int64", m_x | (m_y << 32), "Ptr")
WinGetClass, MyClass, ahk_id %hw_m_target%
WheelSteps := A_EventInfo
DllCall( "SendMessage", "Ptr", hw_m_target, "UInt", 0x20A, "Ptr", WheelSteps * (A_ThisHotkey == "WheelUp" ? 1 : -1) * 120 << 16, "Ptr", ( m_y << 16 )|m_x )

Return


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 16th, 2011, 2:22 pm 
It's this line which makes it beep.

Lines := LinesPerNotch(MinLinesPerNotch, MaxLinesPerNotch, AccelerationThreshold, AccelerationType)

When I replace it with Lines := 1 it doesn't beep.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 16th, 2011, 2:55 pm 
I fixed it by using this small change

Code:
    If(ControlClass1 != ControlClass2 and !MouseIsOver("ahk_class TscShellContainerClass") )
[/quote]


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 16th, 2011, 8:05 pm 
Offline

Joined: November 28th, 2010, 8:37 am
Posts: 48
Location: Wuxi, China
Kelden wrote:
I fixed it by using this small change

Code:
    If(ControlClass1 != ControlClass2 and !MouseIsOver("ahk_class TscShellContainerClass") )


Good work! Actually I've also had to add a couple of exceptions myself to my script. There just isn't a once-size-fits-all script that'll work on everything (subtly covering my ass there) 8)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 31st, 2011, 7:11 pm 
Offline

Joined: March 31st, 2011, 6:28 pm
Posts: 13
I added the following code to Scoox's mouse scrolling script in an attempt to add global horizontal scrolling when holding down the shift key and scrolling the mouse button.

I adapted this by blending the horizontal scrolling example in the Hotkey documentation with Scoox's Focusless scrolling function. It is somewhat limited in what applications will respond to the horizontal scroll message. I expect there is a more compatible message to pass to windows that would work better, and I also had to gut out the acceleration parameter to make it work.

Please post improvements!

Code:
FocuslessScrollHorizontal(MinLinesPerNotch, MaxLinesPerNotch, AccelerationThreshold, AccelerationType, StutterThreshold)
{
   SetBatchLines, -1 ;Run as fast as possible
   CoordMode, Mouse, Screen ;All coords relative to screen

   ;Stutter filter: Prevent stutter caused by cheap mice by ignoring successive WheelUp/WheelDown events that occur to close together.
   If(A_TimeSincePriorHotkey < StutterThreshold) ;Quickest succession time in ms
      If(A_PriorHotkey = "WheelUp" Or A_PriorHotkey ="WheelDown")
         Return

   MouseGetPos, m_x, m_y,, ControlClass2, 2
   ControlClass1 := DllCall( "WindowFromPoint", "int64", (m_y << 32) | (m_x & 0xFFFFFFFF), "Ptr") ;32-bit and 64-bit support

   ctrlMsg := 0x114   ; WM_HSCROLL
   wParam := 0       ; Left

   ;Detect WheelDown event
   If(A_ThisHotkey = "WheelDown" Or A_ThisHotkey = "^WheelDown" Or A_ThisHotkey = "+WheelDown" Or A_ThisHotkey = "*WheelDown")
      wParam := 1 ; Right

   ;Adjust lines per notch according to scrolling speed
   Lines := LinesPerNotch(MinLinesPerNotch, MaxLinesPerNotch, AccelerationThreshold, AccelerationType)

   Loop %Lines%
   {
      SendMessage, ctrlMsg, wParam, 0,, ahk_id %ControlClass1%
      If(ControlClass1 != ControlClass2)
         SendMessage, ctrlMsg, wParam, 0,, ahk_id %ControlClass2%
   }
}

;Shift-Scroll scroll horizontally
+WheelUp::
+WheelDown::FocuslessScrollHorizontal(MinLinesPerNotch, MaxLinesPerNotch, AccelerationThreshold, AccelerationType, StutterThreshold)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 2nd, 2011, 8:02 am 
Offline

Joined: March 7th, 2011, 2:59 am
Posts: 151
I was using the following script successfully until I installed Firefox 4.0, and then it stopped working properly: :roll:
Code:
;http://www.autohotkey.com/forum/topic6772.html
;FocuslessScroll: This code activates the window under the mouse whenever there is a scroll wheel movement.

;Directives
#NoEnv
#SingleInstance Force
#MaxHotkeysPerInterval 100 ;Avoid warning when mouse wheel turned very fast

;Autoexecute code
CoordMode, Mouse, Screen
MinLinesPerNotch := 1
MaxLinesPerNotch := 5
AccelerationThreshold := 100
AccelerationType := "L" ;Change to "P" for parabolic acceleration
StutterThreshold := 10

;Function definitions

;See above for details on parameters
FocuslessScroll(MinLinesPerNotch, MaxLinesPerNotch, AccelerationThreshold, AccelerationType, StutterThreshold)
{
   Critical ;Buffer all missed scrollwheel input to prevent missing notches
   SetBatchLines, -1 ;Run as fast as possible

   ;Stutter filter: Prevent stutter caused by cheap mice by ignoring successive WheelUp/WheelDown events that occur to close together.
   If(A_TimeSincePriorHotkey < StutterThreshold) ;Quickest succession time in ms
      If(A_PriorHotkey = "WheelUp" Or A_PriorHotkey ="WheelDown")
         Return

   MouseGetPos, m_x, m_y
   m_x &= 0xFFFF

   MouseGetPos,,,, ControlClass2, 2
   MouseGetPos,,,, ControlClass3, 3

   ControlClass1 := DllCall("WindowFromPoint", "int", m_x, "int", m_y)
   ;64-bit systems use this line
   ;ControlClass1 := DllCall( "WindowFromPoint", "int64", m_x | (m_y << 32), "Ptr")

   lParam := (m_y << 16) | m_x
   wParam := (120 << 16) ;Wheel delta is 120, as defined by MicroSoft

   ;Detect WheelDown event
   If(A_ThisHotkey = "WheelDown" Or A_ThisHotkey = "^WheelDown" Or A_ThisHotkey = "+WheelDown" Or A_ThisHotkey = "*WheelDown")
      wParam := -wParam ;If scrolling down, invert scroll direction
   
   ;Detect modifer keys held down (only Shift and Control work)
   If(GetKeyState("Shift","p"))
      wParam := wParam | 0x4
   If(GetKeyState("Ctrl","p"))
      wParam := wParam | 0x8

   ;If you don't need scroll acceleration, you can simply remove the LinesPerNotch() function def and set Lines := 1. Additionally you will want to strip out all the related unused function parameters.
   Lines := LinesPerNotch(MinLinesPerNotch, MaxLinesPerNotch, AccelerationThreshold, AccelerationType)

   ;Run this loop several times to create the impression of faster scrolling
   Loop, %Lines%
   {
      If(ControlClass2 = "")
         SendMessage, 0x20A, wParam, lParam,, ahk_id %ControlClass1%
      Else
      {
         SendMessage, 0x20A, wParam, lParam,, ahk_id %ControlClass2%
         If(ControlClass2 != ControlClass3)
            SendMessage, 0x20A, wParam, lParam,, ahk_id %ControlClass3%
      }
   }
}

LinesPerNotch(MinLinesPerNotch, MaxLinesPerNotch, AccelerationThreshold, AccelerationType)
{
   T := A_TimeSincePriorHotkey

   ;Normal slow scrolling, separationg between scroll events is greater than AccelerationThreshold miliseconds.
   If((T > AccelerationThreshold) Or (T = -1)) ;T = -1 if this is the first hotkey ever run
   {
      Lines := MinLinesPerNotch
   }
   ;Fast scrolling, use acceleration
   Else
   {
      If(AccelerationType = "P")
      {
         ;Parabolic scroll speed curve
         ;f(t) = At^2 + Bt + C
         A := (MaxLinesPerNotch-MinLinesPerNotch)/(AccelerationThreshold**2)
         B := -2 * (MaxLinesPerNotch - MinLinesPerNotch)/AccelerationThreshold
         C := MaxLinesPerNotch
         Lines := Round(A*(T**2) + B*T + C)
      }
      Else
      {
         ;Linear scroll speed curve
         ;f(t) = Bt + C
         B := (MinLinesPerNotch-MaxLinesPerNotch)/AccelerationThreshold
         C := MaxLinesPerNotch
         Lines := Round(B*T + C)
      }
   }
   Return Lines
}

;All hotkeys can use the same instance of FocuslessScroll(). No need to have separate calls unless each hotkey requires different parameters (e.g. you want to disable acceleration for Ctrl-WheelUp and Ctrl-WheelDown). If you want a single set of parameters for all scrollwheel actions, you can simply use *WheelUp:: and *WheelDown:: instead.

WheelUp::
^WheelUp:: ;zooms in
WheelDown::
^WheelDown:: ;zoom out
   FocuslessScroll(MinLinesPerNotch, MaxLinesPerNotch, AccelerationThreshold, AccelerationType, StutterThreshold)
Return


So, I came back to this thread, and started using the following script SUCCESSFULLY with FF 4.0: :lol:

Code:
;http://www.autohotkey.com/forum/topic6772.html
;FocuslessScroll: This code activates the window under the mouse whenever there is a scroll wheel movement.

Wheelup::
   SetMouseDelay, -1
   MouseGetPos,,,hovwin,hovcontrol
   WinGetClass, hovclass, ahk_id %hovwin%
   IfWinNotActive, ahk_id %hovwin%
      if hovclass <> #32769
      {
         WinActivate ahk_id %hovwin%
         ControlFocus %hovcontrol%, ahk_id %hovwin%
         return
      }
   mouseclick, wheelup
return
Wheeldown::
   SetMouseDelay, -1
   MouseGetPos,,,hovwin,hovcontrol
   WinGetClass, hovclass, ahk_id %hovwin%
   IfWinNotActive, ahk_id %hovwin%
      if hovclass <> #32769
      {
         WinActivate ahk_id %hovwin%
         ControlFocus %hovcontrol%, ahk_id %hovwin%
         return
      }
   mouseclick, wheeldown
;return


Am I using the latest script version compatible with FF 4.0? :?: Thanks! Image

PS: The above script I am using works with FF 4.0 EXCEPT when the page is PDF in browser (not standalone PDF)... :?

UPDATE: After going through every single script in all 8 pages of this thread, I found the only script that works fully with FF 4.0, including PDF in browser, and every other application -- so far. :lol: This is the ULTIMATE KILLER code in my book! Image PS: The most robust and tight masterpiece of a script! :lol: PS2: 04/05/2011: So far, works flawlessly with FF4 and all other apps!

Code:
; http://www.autohotkey.com/forum/topic6772.html
; http://www.autohotkey.com/forum/viewtopic.php?t=6772&postdays=0&postorder=asc&start=30
; FocuslessScroll: This code activates the window under the mouse whenever there is a scroll wheel movement.

CoordMode Mouse, Screen

WheelTime  = 500
WheelDelta:= 120 << 16
WheelMax  := 4 * WheelDelta

WheelUp::
   Critical
   If (A_ThisHotKey <> A_PriorHotKey OR A_TimeSincePriorHotkey > WheelTime)
        WCnt = %WheelDelta%
   Else If (WCnt < WheelMax)
        WCnt+=  WheelDelta
   MouseGetPos m_x, m_y
   hw_m_target := DllCall("WindowFromPoint", "int",m_x, "int",m_y)
   SendMessage 0x20A, WCnt, (m_y<<16)|m_x,,ahk_id %hw_m_target% ; WM_MOUSEWHEEL
return

WheelDown::
   Critical
   If (A_ThisHotKey <> A_PriorHotKey OR A_TimeSincePriorHotkey > WheelTime)
        WCnt = %WheelDelta%
   Else If (WCnt < WheelMax)
        WCnt+=  WheelDelta
   MouseGetPos m_x, m_y
   hw_m_target := DllCall("WindowFromPoint", "int",m_x, "int",m_y)
   SendMessage 0x20A,-WCnt, (m_y<<16)|m_x,,ahk_id %hw_m_target% ; WM_MOUSEWHEEL
return


Report this post
Top
 Profile  
Reply with quote  
 Post subject: LButton & WheelUp
PostPosted: April 29th, 2011, 7:21 pm 
Hello,
I have been using this script for a couple of weeks now, and it helps me a lot. However, I also use a program called Volumouse that allows me to hold down the left mouse button and scroll up and down to change the volume of my speakers on the fly. This script does not allow the LButton & WheelUp and LButton & WheelDown to function any differently than just WheelUp and WheelDown.
I do not even pretend to understand what the code is doing, but I was wondering if anyone would be interested in modifying the script to do the FocuslessScrolling when just the scroll wheel is used, and allow Volumouse to work when the left mouse button is held down while scrolling?
Thank you in advance for your help.
Dave


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 29th, 2011, 7:31 pm 
Yes, I would also be very interested in your concept... Currently, FocuslessScroll is the only AHK script that enjoys a "permanent status of residency" in my Startup folder! :lol:

Code:
; http://www.autohotkey.com/forum/topic6772.html
; http://www.autohotkey.com/forum/viewtopic.php?t=6772&postdays=0&postorder=asc&start=30
; FocuslessScroll: This code activates the window under the mouse whenever there is a scroll wheel movement.

CoordMode Mouse, Screen

WheelTime  = 500 ; WheelTime = 1000
WheelDelta:= 120 << 16
WheelMax  := 4 * WheelDelta

WheelUp::
   Critical
   If (A_ThisHotKey <> A_PriorHotKey OR A_TimeSincePriorHotkey > WheelTime)
        WCnt = %WheelDelta%
   Else If (WCnt < WheelMax)
        WCnt+= WheelDelta
   MouseGetPos m_x, m_y
   hw_m_target := DllCall("WindowFromPoint", "int",m_x, "int",m_y)
   SendMessage 0x20A, WCnt, (m_y<<16)|m_x,,ahk_id %hw_m_target% ; WM_MOUSEWHEEL
Return

WheelDown::
   Critical
   If (A_ThisHotKey <> A_PriorHotKey OR A_TimeSincePriorHotkey > WheelTime)
        WCnt = %WheelDelta%
   Else If (WCnt < WheelMax)
        WCnt+= WheelDelta
   MouseGetPos m_x, m_y
   hw_m_target := DllCall("WindowFromPoint", "int",m_x, "int",m_y)
   SendMessage 0x20A,-WCnt, (m_y<<16)|m_x,,ahk_id %hw_m_target% ; WM_MOUSEWHEEL
Return


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 13th, 2011, 5:32 pm 
Offline

Joined: January 2nd, 2009, 11:11 am
Posts: 6
Location: UK
I have been using this script for the last 2yrs and on the whole it's great.

Code:
; http://www.autohotkey.com/forum/topic6772.html
; http://www.autohotkey.com/forum/viewtopic.php?t=6772&postdays=0&postorder=asc&start=30
; FocuslessScroll: This code activates the window under the mouse whenever there is a scroll wheel movement.

CoordMode Mouse, Screen

WheelTime  = 500
WheelDelta:= 120 << 16
WheelMax  := 4 * WheelDelta

WheelUp::
   Critical
   If (A_ThisHotKey <> A_PriorHotKey OR A_TimeSincePriorHotkey > WheelTime)
        WCnt = %WheelDelta%
   Else If (WCnt < WheelMax)
        WCnt+=  WheelDelta
   MouseGetPos m_x, m_y
   hw_m_target := DllCall("WindowFromPoint", "int",m_x, "int",m_y)
   SendMessage 0x20A, WCnt, (m_y<<16)|m_x,,ahk_id %hw_m_target% ; WM_MOUSEWHEEL
return

WheelDown::
   Critical
   If (A_ThisHotKey <> A_PriorHotKey OR A_TimeSincePriorHotkey > WheelTime)
        WCnt = %WheelDelta%
   Else If (WCnt < WheelMax)
        WCnt+=  WheelDelta
   MouseGetPos m_x, m_y
   hw_m_target := DllCall("WindowFromPoint", "int",m_x, "int",m_y)
   SendMessage 0x20A,-WCnt, (m_y<<16)|m_x,,ahk_id %hw_m_target% ; WM_MOUSEWHEEL
return



I have 2 screens and if I have 2 Internet Explorer windows open on each screen I can scroll one but not the other. 2 Notepad files or Word files work fine.

Any ideas what needs to be changed to make IE windows work?

_________________
Gigabyte GA-MA770-UD3, QuadCore AMD Phenom II 940, OCZ Gold XTC 2 x 2 GB DDR2-800 DDR2 SDRAM, NVIDIA GeForce 8600 GT, WD 500GB (Raid Edition II) x 3 Raid0, Optiarc DVD RW AD-7201S SATA, Hauppauge Nova-T-PCI DVB-T Tuner, Windows7 x64 Ultimate SP1


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 19th, 2011, 1:30 am 
Offline

Joined: March 16th, 2006, 5:01 pm
Posts: 150
I have an app (word outliner) that doesn't respond to mouse wheel commands. Using katMouse and wizmouse, it does work. But these tools nullify focuslessScroll. In wizMouse I have to enable "convert mouse wheel command into scrollbar commands" to get it to work. I'd like to use focuslessScroll instead, because I like the acceleration and I like that it's ahk. Not needing to install those wizMouse is a plus. Is there any way focuslessScroll would implement this "convert mouse wheel command into scrollbar commands" feature?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 20th, 2011, 11:32 am 
Offline

Joined: March 16th, 2006, 5:01 pm
Posts: 150
For me, this works for a few seconds, then stops working. The script is still alive, but the functionality dissapears. Any idea why? win 7 64 using bug.n.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 4th, 2011, 1:46 pm 
Offline

Joined: June 21st, 2011, 4:13 pm
Posts: 15
Codes are great, BUT it means there is no other functions possible on mouse wheel. If i use ~ before WheelUP/Down all this scripts work incorrect. Example: i use right mouse button + mouse wheel to switch between tabs in Firefox and open images in Photoshop. When i run any script from this tread switches stop work. Is there any way to fix this problem?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 14th, 2012, 5:13 pm 
Offline

Joined: January 12th, 2011, 4:04 pm
Posts: 93
Location: Kansas City, USA
Has anyone come to a further script conclusion here? I have tried all the focusless scrolling programs out there - whizmouse, katmouse, mousetrap (powerpro), and use a combination of wheelmouse and mousetrap, but it still doesn't work right all the time on my windows XP.

I have followed all these pages, but it looks like everyone left off back last June.

How about no


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 27th, 2012, 3:35 pm 
Offline

Joined: February 27th, 2012, 3:32 pm
Posts: 10
BGM wrote:
Has anyone come to a further script conclusion here? I have tried all the focusless scrolling programs out there - whizmouse, katmouse, mousetrap (powerpro), and use a combination of wheelmouse and mousetrap, but it still doesn't work right all the time on my windows XP.

I have followed all these pages, but it looks like everyone left off back last June.

How about no


Try this one, if you will :D

http://www.autohotkey.com/forum/viewtopic.php?t=83037


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 120 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8

All times are UTC [ DST ]


Who is online

Users browsing this forum: notsoobvious and 11 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group