StrokesPlus.net
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
misaki4650  
#1 Posted : Sunday, March 14, 2021 12:53:14 AM(UTC)
misaki4650

Rank: Member

Reputation:

Groups: Approved
Joined: 2/21/2021(UTC)
Posts: 15
Japan
Location: nagano

Thanks: 16 times
Mr. Rob, I need your help again.

I have an acceleration wheel script in AutoHotkey, but if I put a wheel script with a different movement in strokesplus.net, one of them stops working.
It would be great if you could create a simple acceleration wheel script for strokesplus.net.

111.zip WheelAccel.ahk: WheelScroll.ahk
http://lukewarm.s101.xrea.com/up/
http://mobitan.org/ahk/WheelAccel.txt

Initially, it scrolls at the number of lines set in the utility, etc., and if you keep turning the wheel within 250ms, it will gradually accelerate to 4x, 7x, 10x, 13x, and 16x (maximum).
https://hail2u.net/blog/coding/a...lerate-wheel-scroll.html

_______________________________

I have one question about scrolling.
sp.MouseWheel(new Point(100, 100), false, 120);

If I set 120 to 1200, it scrolls a lot.
If I set it to a higher number, say 3600, the amount of scrolling is the same as 1200, is there an upper limit?
Rob  
#2 Posted : Monday, March 15, 2021 4:11:01 AM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,349
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 416 time(s) in 354 post(s)
I don't see anything in the documentation regarding the maximum delta:

https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-mousewheel

I think it might just be sending multiple mouse wheel events with a high delta to multiply the event.

Looking at this, it appears it's simply sending the mouse wheel multiple times based on the timing.

This seems to work for me, in Mouse Events > Mouse Wheel.
Code:
var wheelFastScrollTicks = 2500000; //250ms
var wheelLastTick = parseInt(sp.GetStoredObject("WheelLastTick")) || 0;

if(sp.GetStoredBool("WheelForward") != wheel.Delta > 0 || wheelLastTick === 0 || (DateTime.Now.Ticks - wheelLastTick) > wheelFastScrollTicks) {
    sp.StoreNumber("WheelCount", 1);
} else if (sp.GetStoredNumber("WheelCount") < 40) {
    sp.StoreNumber("WheelCount", sp.GetStoredNumber("WheelCount") + 1);
}

var scrollCount = sp.GetStoredNumber("WheelCount");
for(var ic = 0; ic < scrollCount; ic++) {
    sp.MouseWheel(wheel.Point, wheel.Horizontal, wheel.Delta); 
}

sp.StoreBool("WheelForward", wheel.Delta > 0);
sp.StoreObject("WheelLastTick", DateTime.Now.Ticks);



thanks 1 user thanked Rob for this useful post.
misaki4650 on 3/15/2021(UTC)
misaki4650  
#3 Posted : Monday, March 15, 2021 1:16:20 PM(UTC)
misaki4650

Rank: Member

Reputation:

Groups: Approved
Joined: 2/21/2021(UTC)
Posts: 15
Japan
Location: nagano

Thanks: 16 times
A lot of Japanese users said, "I'll move to strokesplus.net if it can do accelerated scrolling. "
It's what we've all been waiting for.
Thank you very much.BigGrin
Rob  
#4 Posted : Monday, March 15, 2021 3:48:47 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,349
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 416 time(s) in 354 post(s)
Glad to hear!

However, I will say that for the most efficiency, this should really be put into a plug-in (using the mouse wheel event) - which I will see if I can get around to soon.

By using the script, each tick of the wheel has to get the script and invoke the script engine to execute it, which is a lot of overhead when you're scrolling the wheel a lot.

A plug-in bound to the wheel event would be able to trigger the actions much faster, avoiding multiple wheel events getting queued up to be executed by the script engine.

I will follow up when I've translated this to a plug-in.
thanks 1 user thanked Rob for this useful post.
misaki4650 on 3/15/2021(UTC)
Rob  
#5 Posted : Monday, March 15, 2021 8:40:49 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,349
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 416 time(s) in 354 post(s)
Try this and let me know how it works for you:

https://www.strokesplus.net/files/MouseWheelAcceleration_Source_1.0.zip

It's the entire source of the plug-in, so feel free to change it as you like!

In the bin/Release folder is the plug-in, MouseWheelAcceleration.dll - you can just extract that file and add the plug-in to S+.

It supports a few properties to adjust the timing, multiplier/division values, and count cap (from this post https://hail2u.net/blog/coding/autohotkey-accelerate-wheel-scroll.html)
Code:
MouseWheelAcceleration.ResetMilliseconds = 40;
MouseWheelAcceleration.WheelCountCap = 40;
MouseWheelAcceleration.WheelCountDivide = 8
MouseWheelAcceleration.WheelCountMultiplier = 3

I set my timeout (ResetMilliseconds) to 40 milliseconds so it doesn't start to scroll too fast unless I scroll fast.
The other values shown above are their defaults, so you don't need to include them.

I put the above code in my Load tab.

Note that this binds to the asynchronous mouse event, so it does not interfere with the mouse wheel event (nor will it consume it), but I only send additional mouse wheel events if the wheelCount is greater than 1, so a single wheel scroll doesn't always send an extra one.

P.S. You might need to right-click the DLL and mark it as safe/unblock if you used Windows to extract the zip file.
thanks 1 user thanked Rob for this useful post.
misaki4650 on 3/16/2021(UTC)
misaki4650  
#6 Posted : Tuesday, March 16, 2021 11:34:20 AM(UTC)
misaki4650

Rank: Member

Reputation:

Groups: Approved
Joined: 2/21/2021(UTC)
Posts: 15
Japan
Location: nagano

Thanks: 16 times
I can't believe you even made a plugin for it.
It's working just fine!!
I really appreciate it.

_____________________________

By the way, I have another question, if you don't mind.

Originally Posted by: Rob Go to Quoted Post
I have the mouse wheel script and do not have an issue scrolling in the Start menu.

Looking at the code in your recent post, it looks like it's an older version of my example.

These lines:
Code:
wheel.Control.PostMessage(host.cast(uint, 0x020A), new IntPtr(wheel.WParam), new IntPtr(wheel.LParam));

Should be replaced with:
Code:
sp.MouseWheel(wheel.Point, false, wheel.Delta);




The script above, for example Change culture in the action list of strokesplus.net is a long script, but the wheel does not work immediately.
But one click and it works.
This is also the case with Windows Live Mail.

Code:
Wheel.Control.PostMessage(host.cast(uint, 0x020A), new IntPtr(wheel.WParam), new IntPtr(wheel.LParam));

If you use this, the wheel will work immediately.

I wonder why it doesn't work with the new one.

UserPostedImage

Edited by user Tuesday, March 16, 2021 11:36:43 AM(UTC)  | Reason: Not specified

Rob  
#7 Posted : Tuesday, March 16, 2021 12:18:23 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,349
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 416 time(s) in 354 post(s)
Code:
wheel.Control.PostMessage(host.cast(uint, 0x020A), new IntPtr(wheel.WParam), new IntPtr(wheel.LParam));

This posts the wheel scroll message directly to the control below the mouse - which often works fine, but it causes issues in some programs.
So I've recommended using the standard mouse wheel injected input method which lets Windows/apps process it just like a normal mouse wheel event.

In Windows 10, the setting below supports using sp.MouseWheel and will work over inactive controls.

Mouse Settings

However, you're not using Windows 10, you might opt to use the control PostMessage method, though you might have to make a special else block to handle any apps which do not respond to the mouse wheel being posted to the control directly.

Edited by user Tuesday, March 16, 2021 2:23:08 PM(UTC)  | Reason: Not specified

thanks 1 user thanked Rob for this useful post.
misaki4650 on 3/16/2021(UTC)
Rob  
#8 Posted : Tuesday, March 16, 2021 12:20:24 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,349
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 416 time(s) in 354 post(s)
Of course, if you're also using the plug-in, you will probably need to change the code to post message as well. You could add a new property to support a list of EXEs that should be handled differently, which can be assigned to the plug-in's property in the Load tab if you needed to.
thanks 1 user thanked Rob for this useful post.
misaki4650 on 3/16/2021(UTC)
Rob  
#9 Posted : Tuesday, March 16, 2021 12:22:38 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,349
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 416 time(s) in 354 post(s)
By the way, I run with the mouse wheel acceleration plug-in, it's really great!

So thanks for bringing it to my attention :)
thanks 2 users thanked Rob for this useful post.
misaki4650 on 3/16/2021(UTC), soooulp on 3/16/2021(UTC)
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.