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  Next
Author Message
 Post subject:
PostPosted: February 2nd, 2011, 11:41 am 
Offline

Joined: November 28th, 2010, 8:37 am
Posts: 48
Location: Wuxi, China
** Please check latest version from Wed Feb 02, 2011 10:12 am, it's on page 6 of this thread!! **

Some comments regarding your suggestions from the previous update, and how they have been incorporated into the latest update.
JohnCritton wrote:
You need to make a small change in the code to get the negative coordinates working.
Since you are now using m_x for the DLL call as well as for the lParam the masking must happen after the DLL call:
Code:
ControlClass1 := DllCall("WindowFromPoint", "int", m_x, "int", m_y)
m_x &= 0xFFFF

Otherwise the DLLCall will have the wrong m_x since it is using a 32Bit integer and not a 16Bit Integer like lParam.

Thanks for this, I’ve looked at it in more detail and now it all makes sense. An interesting observation is that when monitors are set up to be one above the other m_y may take negative values too. The good news is that this scenario is automatically covered!
JohnCritton wrote:
As for the 64Bit OS.
According to your comment in the code a 64Bit lParam is required. I don't know if MouseGetPos will return a 32Bit or 64Bit integer for m_x in a 64Bit OS.
If a 32Bit Integer is returned for m_x, the masking must not be done.
If a 64Bit Integer is returned for m_x, the masking must be changed to m_x &= 0xFFFFFFFF to preserve only the lower 32Bit of m_x an set the higher 32Bit to 0.

You are right. The latest update includes exactly that. I have upgraded the code to work on both 32-bit and 64-bit systems, based on the information found here, as follows:
HotKeyIt wrote:
Code:
DllCall( "WindowFromPoint", "int64", m_x | (m_y << 32), "Ptr")
But this still needs testing...

grannyGrump NLI wrote:
I will test on my Vista 64-bit when I get home, and report any strange results.

Please do! If you can test this update on both your 32-bit machine and your 64-bit machine without modification just to check that the script really does work on both platforms.
JohnCritton wrote:
I have noticed a strange effect on the Main Pane of the AHK Help File (ClassNN: Internet Explorer_Server1). And only there.
Even so I have set Lines := 1 and both min and MaxLinesPerNotch to 1 there is some strange inertia effect. If I turn the MouseWheel in a fast motion, the Page continues scrolling for a few 100 ms even after the mouse wheel did stop. Similar to the effect know form iPhone and other touch devices.
No other Apps is showing this effect. The Index of the AHK Help is also working fine. When I stop the wheel, the scrolling stops immediately.
Very strange. Maybe you can have a look in to this.

I have read through the whole thread (I should have done this before...) and discovered that, while nobody got as far with this script as we have, they did identify some of the problems that we have encountered. The "momentum" or "drag" problem you describe, as you noticed, does not affect all apps.

1) AHK help: Without the script running, it works fine, but with the script Running, you get drag..
2) MS WordPad: You get drag wether or no the script is running! (XP Wordpad)
3) Notepad: No problems whether the script is running or not.

The problem arises when the app over which you are scrolling cannot catch up with the scroll commands being sent to it because they are being sent too rapidly. You'll find that most apps that have smooth scrolling will exhibit this behaviour to some extent. Here's why:

1) WordPad: The app accepts the commands, but it's too busy doing the smooth-scroll eyecandy, so it buffers the commands for later execution. AHK keeps sending commands because WordPad accepts them, when in actual fact a bunch of the commands have not been executed yet. Unless smooth scrolling can be disabled, there is nothing we can do about these apps.
2) AHK Help: It refuses to accept further scroll commands until the current scroll command has been completed. In this case it becomes AHK's job to either buffer the scroll commands or trash them. Luckily we can do something about this because we have full control over our scripts.
3) Notepad: Notepad (and most apps) quite happily accepts quick scroll commands and executes them in real time, as it gives them high priority, and so scrolling is responsive.

This problem was actually pointed out long ago in this very thread!:

Laszlo wrote:
Instead of buffering all the hotkeys with "critical", we can buffer only a certain number of them with the 2 lines below, added in front of the hotkey definitions (and removing critical)
Code:
#MaxThreadsBuffer On
#MaxThreadsPerHotkey 5
With this shorter memory there is no such a long scrolling period, after the whell was released.


Note that this problem also affects third-party focusless scrolling apps, but to a lesser extent, which made me think that it had to do with the way my previous script increased lines-per-notch by sending multiple scroll commands rather than by increasing the scrollstep directly, which resulted in more processing going on and therefore slower execution. However note that some GUI controls ignore the scroll-step value altogether, which means there would be no acceleration on some controls. The latest update has been optimized to take all this into account and ensures that all controls can be scrolled with acceleration, whilst drastically mitigating the momentum problem where required.

In addition I have added #MaxThreadsPerHotkey directives before and after your scrollwheel hotkeys, and removed the "Critical" command at the top of FocuslessScroll(), which is no longer needed. All of these improvements combined make the momentum problem almost unnoticeably, although it cannot be 100% removed.

I might be wrong but I don't think #MaxThreadBuffer On directive should be used (see the helpfile for details), unlike Laszlo's post suggests. Please prove me wrong though.

-Scoox


Last edited by Scoox on February 2nd, 2011, 7:18 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 2nd, 2011, 7:14 pm 
Offline

Joined: March 1st, 2007, 7:37 pm
Posts: 14
Great Update Scoox. It works now perfectly well on everything I tried so far. Focusless Scroll & Zoom is such a great addition to the overall Windows user experience that I wouldn't want to miss it.
Thanks for the explanation of the momentum scroll issue. It now makes sense, why only the AHK Help File (among other selected apps) was affected.

-John


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 2nd, 2011, 7:20 pm 
Offline

Joined: November 28th, 2010, 8:37 am
Posts: 48
Location: Wuxi, China
JohnCritton wrote:
Great Update Scoox. It works now perfectly well on everything I tried so far. Focusless Scroll & Zoom is such a great addition to the overall Windows user experience that I wouldn't want to miss it.
Thanks for the explanation of the momentum scroll issue. It now makes sense, why only the AHK Help File (among other selected apps) was affected.

-John

Thanks for testing and nice to hear it works! Actually I got a couple of things the wrong way round in the explanation, sorted now.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 3rd, 2011, 3:44 am 
I couldn't test that script from 02-Feb 08:43 am, immediate crash in both XP and Vista, the WindowFromPoint DLLCall was the culprit.

I will try again tonight with the new one from 02-Feb 10:12 am (that wasn't posted yet when I went home for the day).

I can say that the one from 01-Feb 2:45 pm did work well on Vista 64-bit, only two minor issues, I will see if they are still there with the newest one.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 3rd, 2011, 5:11 pm 
Offline

Joined: November 28th, 2010, 8:37 am
Posts: 48
Location: Wuxi, China
grannyGrump NLI wrote:
I couldn't test that script from 02-Feb 08:43 am, immediate crash in both XP and Vista, the WindowFromPoint DLLCall was the culprit.

I will try again tonight with the new one from 02-Feb 10:12 am (that wasn't posted yet when I went home for the day).

I can say that the one from 01-Feb 2:45 pm did work well on Vista 64-bit, only two minor issues, I will see if they are still there with the newest one.


The script on 02-Feb 08:43 am was uploaded temporarily. I spotted a bug in it and deleted the post immediately to avoid confusion. Unfortunately you were already testing it by the time I realised my mistake.

The script on 02-Feb 10:12 am, which is the latest update, should work.


Last edited by Scoox on February 4th, 2011, 4:35 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 4th, 2011, 12:26 am 
Well, ignore the crash remark, it was a PEBCAK
:oops:

All apps tested in both XP x86 and Vista x64, and behavior was the same in each OS, which is to say, "excellent".
Internet Explorer, Opera 9.64, 10.6, 11; QtWeb, Chrome, Iron, Maxthon2, Adobe reader, PDF X-change pdf viewer, Sumatra pdf viewer, MS Office 2003, OpenOffice v 2.04, AbiWord, Softmaker Office, Wordpad, Jarte, Notepad++, Windows Explorer, Total Commander, FreeCommander, xplorer2, Cubic Explorer, Qdir.

I left all configurations at the original scripted settings, no tweaks.
There was still just a bit of "drag" for Wordpad and Jarte (built upon wordpad), the scroll continues for a bit after the wheel stops, but much improved.
Total Commander is very slow, but I think due to their GUI design--- the scroll bar is proportionately very large compared to the length of the page, so even its native scrolling is a bit odd.
No remote Zoom-Scroll in my antique copy of Firefox v 2, ( I am not a fan), but this may have changed in newer versions.


So, all I have to say is *** Well Done, and Thank You ***


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 4th, 2011, 4:58 am 
Offline

Joined: November 28th, 2010, 8:37 am
Posts: 48
Location: Wuxi, China
grannyGrump NLI wrote:
All apps tested in both XP x86 and Vista x64, and behavior was the same in each OS, which is to say, "excellent".
Internet Explorer, Opera 9.64, 10.6, 11; QtWeb, Chrome, Iron, Maxthon2, Adobe reader, PDF X-change pdf viewer, Sumatra pdf viewer, MS Office 2003, OpenOffice v 2.04, AbiWord, Softmaker Office, Wordpad, Jarte, Notepad++, Windows Explorer, Total Commander, FreeCommander, xplorer2, Cubic Explorer, Qdir.
I think am happy today! :lol:

grannyGrump NLI wrote:
There was still just a bit of "drag" for Wordpad and Jarte (built upon wordpad), the scroll continues for a bit after the wheel stops, but much improved.
Please note that in apps like WordPad the drag problem will also happen even WITHOUT the script running at all, so it is inherent in the app itself. Fortunately apps like these don't abound!

grannyGrump NLI wrote:
Total Commander is very slow, but I think due to their GUI design--- the scroll bar is proportionately very large compared to the length of the page, so even its native scrolling is a bit odd.
What version of Total Commander are you running? I have just installed their latest version (v756a) and it works 100% fine.

grannyGrump NLI wrote:
No remote Zoom-Scroll in my antique copy of Firefox v 2, ( I am not a fan), but this may have changed in newer versions.
Running Firefox v3.6.12 here and it hasn't changed. I have tried using a hotkey other than the scroll wheel to remote-zoom but it still doesn't work. Since I haven't found another app that exhibits this behaviour, I assume it is connected with FF's implementation.[/quote]


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 4th, 2011, 5:43 am 
@Scoox
Re: FireFox === It has a a lot of unusual behavior compared to many apps, for example, in my old version, the zoom scroll is backward from 95% of everything else ---- I think the effect was intended to be "pulling it closer to you/pulling the wheel down" and "pushing it away / up". But it is one reason I never became a FF user.

Total Commander, I'm using v 7.50. In native scroll, it is slow, and kind of speeds and slows down, hard to describe.

I guess WordPad and its smooth-scrolling brethren will just have to be tolerated. I'm trying to learn to love Jarte, but it is a rough road with a "unique" GUI. To be honest, I use and do love an old tabbed rich-text editor called kPad, circa 2000, and only 150 kb.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 4th, 2011, 6:02 am 
Offline

Joined: November 28th, 2010, 8:37 am
Posts: 48
Location: Wuxi, China
grannyGrump NLI wrote:
@Scoox
Re: FireFox === It has a a lot of unusual behavior compared to many apps, for example, in my old version, the zoom scroll is backward from 95% of everything else ---- I think the effect was intended to be "pulling it closer to you/pulling the wheel down" and "pushing it away / up". But it is one reason I never became a FF user.

Total Commander, I'm using v 7.50. In native scroll, it is slow, and kind of speeds and slows down, hard to describe.

I guess WordPad and its smooth-scrolling brethren will just have to be tolerated. I'm trying to learn to love Jarte, but it is a rough road with a "unique" GUI. To be honest, I use and do love an old tabbed rich-text editor called kPad, circa 2000, and only 150 kb.

You may want to have a look at this: Scrolling the file list in Total Commander is slow


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 4th, 2011, 7:21 am 
Thanks for that link :)
Sadly, it didn't improve performance on XP. I don't think running it from a portable drive should have any bearing on this, but I'll test my installed version on Vista when I get home.
Maybe I just need to upgrade to newest version. :)

However, your script makes it scroll smoother, although slower.
Instead of a speed-up, plateau, and slowdown with each spin of the wheel, with the script running the scroll is smooth and steady with no "acceleration curve".

Here's to "Scoox's Supreme Scroller"!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 2nd, 2011, 5:49 pm 
Offline

Joined: February 2nd, 2011, 4:21 am
Posts: 247
Nvm.. I'm a nuisance-scatch my post.

_________________
Reality cannot be altered because others might get lost.


Last edited by DethKlok on March 4th, 2011, 8:10 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 3rd, 2011, 4:09 am 
Offline

Joined: September 13th, 2010, 10:11 am
Posts: 51
Location: rock>8<hardplace
For vertical scrolling to use the SendMessage 0x20A for uncooperative windows, I have some hard-coded exceptions that use ControlFocus, then the SendMessage does work.
With MS Word, I use this:
Code:
If (winClass = "OpusApp"
   ControlFocus, , ahk_id %DllTarget%

For horizontal scrolling, ControlSend works for me without activating that window *IF* I use ControlFocus with the scrollbar ClassNN.
Code:
If (winClass = "OpusApp")
   ControlFocus, ScrollBar2 , ahk_id %DllTarget%
   ControlSend, ScrollBar2 , Right, ahk_id %DllTarget%


If there are multiple Word windows open, ControlFocus lifts the scrolled window above other Word windows, but doesn't bring it to the top of the stack.
ControlFocus doesn't work for Excel though, Excel needs a ControlClick.

It seems like Microsoft software is the least cooperative to use Microsoft OS API calls and Dll calls.

_________________
Antique Newbie


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 8th, 2011, 1:03 am 
Offline

Joined: October 7th, 2006, 4:50 pm
Posts: 3157
Location: MN, USA
I found this topic very helpful and interesting. Since I was looking for the simplest possible solution without any bells and whistles, I trimmed the code down to this.
Code:
CoordMode, Mouse, Screen

WheelUp::Scroll(7864320)  ;WHEEL_DELTA := (120 << 16)
WheelDown::Scroll(-7864320)

Scroll(WHEEL_DELTA) {
 MouseGetPos, mX, mY, hWin, hCtrl, 2
 PostMessage, 0x20A, WHEEL_DELTA, (mY << 16) | mX,,% "ahk_id" (hCtrl ? hCtrl:hWin)
}  ;WM_MOUSEWHEEL

In Win7 x64 it's working great.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: @Scoox
PostPosted: March 16th, 2011, 9:56 am 
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?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 16th, 2011, 9:56 am 
My message above was for Scoox


Report this post
Top
  
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  Next

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