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

Notification

Icon
Error

Options
Go to last post Go to first unread
zyxi  
#1 Posted : Friday, June 14, 2019 6:57:44 AM(UTC)
zyxi

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 3/30/2019(UTC)
Posts: 67
China

Thanks: 7 times
Was thanked: 1 time(s) in 1 post(s)
Dear,Rob
Could you share your following Mouse Wheel Script. I think it's great for me. Thank you.

UserPostedImage
Rob  
#2 Posted : Friday, June 14, 2019 7:26:50 AM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 636
United States

Thanks: 11 times
Was thanked: 143 time(s) in 125 post(s)
Code:
if(wheel.Window.Process.MainModule.ModuleName == "chrome.exe" || wheel.Window.Process.MainModule.ModuleName == "notepad++.exe") {
    if(parseInt(wheel.Y) <= (parseInt(wheel.Window.Rectangle.Top) + 64)) {//is the mouse in the top 64 pixel area of the window?
        wheel.Window.BringToFront();
        if(wheel.Delta > 0) {
            //mouse wheel scrolled up
            sp.SendKeys("^{TAB}");
        } else {
            //mouse wheel scrolled down
            sp.SendKeys("^+{TAB}");
        }
    } else if(wheel.X >= (parseInt(wheel.Window.Rectangle.Right) - 25)) { //is the mouse along the right side of the window?
        wheel.Window.BringToFront();
        if(wheel.Delta > 0) {
            //scroll up, send CTRL+Home to go to the top of the page
            sp.SendKeys("^{HOME}");
        } else {
            //scroll up, send CTRL+End to go to the end of the page
            sp.SendKeys("^{END}");
        }
    } else if(wheel.Window.Process.MainModule.ModuleName == "chrome.exe" && wheel.X <= (parseInt(wheel.Window.Rectangle.Left) + 20)) {
        wheel.Window.BringToFront();
        if(wheel.Delta > 0){
            //scroll up, send CTRL+Home to go to the top of the page
            sp.SendKeys("{F5}");
        } else {
            //scroll up, send CTRL+End to go to the end of the page
            sp.SendVKey(vk.BROWSER_BACK);
        }
    } else {
        //Default, pass mouse wheel message onto the original control
        //wnd.PostMessageObj(0x020A, wheelTickVars.WParam, wheelTickVars.LParam);
        //sp.MouseWheel(wheel.Point, false, wheel.Delta);
        wheel.Control.PostMessage(host.cast(uint, 0x020A), new IntPtr(wheel.WParam), new IntPtr(wheel.LParam));
    }
} else {
    //Default, pass mouse wheel message onto the original control
    //wnd.PostMessageObj(0x020A, wheelTickVars.WParam, wheelTickVars.LParam);
    //sp.MouseWheel(wheel.Point, false, wheel.Delta);
    //wheel.Control.PostMessage(host.cast(uint, 0x020A), new IntPtr(wheel.WParam), new IntPtr(wheel.LParam));
    //wheel.Control.PostMessage(host.cast(uint, 0x020A), new IntPtr(0x00780000+0x08), new IntPtr(wheel.Y << 16 + wheel.X)); - control+wheel
    wheel.Control.PostMessage(host.cast(uint, 0x020A), new IntPtr(wheel.WParam), new IntPtr(wheel.LParam));
}
thanks 2 users thanked Rob for this useful post.
zyxi on 6/14/2019(UTC), thepromises on 6/14/2019(UTC)
Rob  
#3 Posted : Friday, June 14, 2019 7:40:27 AM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 636
United States

Thanks: 11 times
Was thanked: 143 time(s) in 125 post(s)
Ignore my bad comments and extra commented out code, it's an old script that I didn't look over before posting :P
thanks 1 user thanked Rob for this useful post.
thepromises on 6/14/2019(UTC)
zyxi  
#4 Posted : Friday, June 14, 2019 9:26:51 AM(UTC)
zyxi

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 3/30/2019(UTC)
Posts: 67
China

Thanks: 7 times
Was thanked: 1 time(s) in 1 post(s)
Yes, it's good except for delaying the mouse wheel. Thank you, Rob.
Rob  
#5 Posted : Friday, June 14, 2019 11:49:00 AM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 636
United States

Thanks: 11 times
Was thanked: 143 time(s) in 125 post(s)
Yep, that's the trade-off.
zyxi  
#6 Posted : Friday, June 14, 2019 12:49:00 PM(UTC)
zyxi

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 3/30/2019(UTC)
Posts: 67
China

Thanks: 7 times
Was thanked: 1 time(s) in 1 post(s)
Dear Rob, I want to use the following script to implement ”Ctrl + wheel “, but the wheel can perform zooming function while I am pressing the middle mouse button .
In fact, I want to achieve ”Ctrl + wheel “ through the wheel alone, (or you can press the middle key and release the script to achieve it).
Is this possible?


UserPostedImage
Code:

if (!sp.GetStoredBool("Window_selection")) {
 sp.SendVKeyDown( vk.LCONTROL); 
sp.MouseWheel(wheel.Point, false, wheel.Delta);
    sp.StoreBool("Window_selection", true)}


Auxiliary script

UserPostedImage

Code:
if (sp.GetStoredBool("Window_selection") && !click.Down) {
    sp.SendVKeyUp(vk.LCONTROL);
    sp.StoreBool("Window_selection", false);
}



Rob  
#7 Posted : Friday, June 14, 2019 1:24:59 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 636
United States

Thanks: 11 times
Was thanked: 143 time(s) in 125 post(s)
Hmm, I'm going to have to think about this one.

I don't think it's going to work very well, as I'm sure you've already found out.

There are a lot of things you'd be trying to inject/interfere with that will likely result in some odd behaviors.

Edited by user Friday, June 14, 2019 1:26:35 PM(UTC)  | Reason: Not specified

lyscop  
#8 Posted : Friday, May 8, 2020 9:42:50 AM(UTC)
lyscop

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 4/23/2020(UTC)
Posts: 39
China

Thanks: 5 times
Was thanked: 1 time(s) in 1 post(s)
Originally Posted by: Rob Go to Quoted Post



Dear Rob,

I am here to disturb you again.

This script in the S+Net is useful, but I find a problem in my Win10 today.

It works well in any program screen, except the original vision of the windows taskbar, if I open the mouse wheel script in Global Action.

As the following photo, when I click the Start Menu and the Message Button, the new screen will popup, but I can not use my mouse wheel to scroll up/down.

Can you help me?

UserPostedImage
lyscop  
#9 Posted : Sunday, May 10, 2020 9:43:37 AM(UTC)
lyscop

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 4/23/2020(UTC)
Posts: 39
China

Thanks: 5 times
Was thanked: 1 time(s) in 1 post(s)
Originally Posted by: lyscop Go to Quoted Post
Originally Posted by: Rob Go to Quoted Post



Dear Rob,

I am here to disturb you again.

This script in the S+Net is useful, but I find a problem in my Win10 today.

It works well in any program screen, except the original vision of the windows taskbar, if I open the mouse wheel script in Global Action.

As the following photo, when I click the Start Menu and the Message Button, the new screen will popup, but I can not use my mouse wheel to scroll up/down.




It is done.

I find the answer in this post https://forum.strokesplus.net/po...t6042-system-volume-help

Use this instead of default wheel function, pass mouse wheel message onto the original control

sp.MouseWheel(wheel.Point, wheel.Horizontal, wheel.Delta);


Rob  
#10 Posted : Wednesday, May 13, 2020 6:56:15 AM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 636
United States

Thanks: 11 times
Was thanked: 143 time(s) in 125 post(s)
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);
lyscop  
#11 Posted : Wednesday, May 13, 2020 7:51:29 AM(UTC)
lyscop

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 4/23/2020(UTC)
Posts: 39
China

Thanks: 5 times
Was thanked: 1 time(s) in 1 post(s)
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);


Thank you again, Rob.

After replacing the code you reply now or your post in that discussion, it is perfect to solve the problem.

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.