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 12:57:44 PM(UTC)
zyxi

Rank: Advanced Member

Reputation:

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

Thanks: 8 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 1:26:50 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:
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 3 users thanked Rob for this useful post.
zyxi on 6/14/2019(UTC), thepromises on 6/14/2019(UTC), tony.zed on 3/28/2024(UTC)
Rob  
#3 Posted : Friday, June 14, 2019 1:40:27 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)
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 3:26:51 PM(UTC)
zyxi

Rank: Advanced Member

Reputation:

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

Thanks: 8 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 5:49:00 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)
Yep, that's the trade-off.
zyxi  
#6 Posted : Friday, June 14, 2019 6:49:00 PM(UTC)
zyxi

Rank: Advanced Member

Reputation:

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

Thanks: 8 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 7:24:59 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)
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 7:26:35 PM(UTC)  | Reason: Not specified

lyscop  
#8 Posted : Friday, May 8, 2020 3:42:50 PM(UTC)
soooulp

Rank: Advanced Member

Reputation:

Groups: Moderators, Approved
Joined: 4/23/2020(UTC)
Posts: 161
China

Thanks: 46 times
Was thanked: 23 time(s) in 17 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 3:43:37 PM(UTC)
soooulp

Rank: Advanced Member

Reputation:

Groups: Moderators, Approved
Joined: 4/23/2020(UTC)
Posts: 161
China

Thanks: 46 times
Was thanked: 23 time(s) in 17 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 12:56:15 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)
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);
soooulp  
#11 Posted : Wednesday, August 18, 2021 5:04:36 PM(UTC)
soooulp

Rank: Advanced Member

Reputation:

Groups: Moderators, Approved
Joined: 4/23/2020(UTC)
Posts: 161
China

Thanks: 46 times
Was thanked: 23 time(s) in 17 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.



How to forbid the original Chrome scroll when I set the mouse wheel script on the bounds Right or left of the screen to do something instead of a window that will misoperation?


Code:

if(mouseLocation.X >= currentScreen.Bounds.Right - 25) {
   if(wheel.Window.Process.MainModule.ModuleName == "chrome.exe" || wheel.Window.Process.MainModule.ModuleName == "msedge.exe") {
       if(wheel.Delta > 0) {
            //mouse wheel scrolled up
            sp.SendKeys("^+{TAB}");
        } else {
            //mouse wheel scrolled down
            sp.SendKeys("^{TAB}");
        }
    } else {
        sp.MouseWheel(wheel.Point, false, wheel.Delta); 
    }
} else if(mouseLocation.X <= currentScreen.Bounds.Left + 20) {
    if(wheel.Delta > 0){
        //scroll up, send 
        ScreenBrightness.ScreenBrightness.Adjust("10+");
    } else {
        //scroll down, send 
        ScreenBrightness.ScreenBrightness.Adjust("10-");
    }
}
Rob  
#12 Posted : Wednesday, August 18, 2021 5:14:27 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)
If you check the Consume box, it will prevent the normal mouse wheel message from being sent to applications.
Rob  
#13 Posted : Wednesday, August 18, 2021 5:43: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)
UserPostedImage
thanks 2 users thanked Rob for this useful post.
soooulp on 8/18/2021(UTC), Strobiker on 8/18/2021(UTC)
soooulp  
#14 Posted : Wednesday, August 18, 2021 5:45:01 PM(UTC)
soooulp

Rank: Advanced Member

Reputation:

Groups: Moderators, Approved
Joined: 4/23/2020(UTC)
Posts: 161
China

Thanks: 46 times
Was thanked: 23 time(s) in 17 post(s)
Originally Posted by: Rob Go to Quoted Post
UserPostedImage


Aha, find it, it is interesting about the Consume.

Strobiker  
#15 Posted : Wednesday, August 18, 2021 9:03:24 PM(UTC)
Strobiker

Rank: Member

Reputation:

Groups: Approved
Joined: 10/15/2019(UTC)
Posts: 10

Thanks: 2 times
Recently I had problems with the scroll on the right to scroll to the botton/top functionality in Chrome. Activating "Consume" solved it for - so far! Great!



2014218866  
#16 Posted : Tuesday, January 31, 2023 8:40:59 AM(UTC)
2014218866

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 5/6/2019(UTC)
Posts: 111
China

Thanks: 19 times
Was thanked: 1 time(s) in 1 post(s)
Hello, dear friends. I don't know how to solve the problem when I encounter it. Would anyone like to help me? Thank you very much. When the computer is working, I divide the computer screen into upper and lower areas, with Word in the upper half and Excel in the lower half. S+can only change the screen brightness when the mouse is used on Word. S+can only change the volume, when the mouse is used on Excel. The script can work normally only when the window is maximized. I don't know why. The code is as follows


Code:


var exeName = wheel.Window.Process.MainModule.ModuleName
//is the mouse along the right side of the window?

if(wheel.X >= (parseInt(wheel.Window.Rectangle.Right) - 30)) { 
   wheel.Window.BringToFront();
   if(wheel.Delta > 0){//滚轮向上
        if(wheel.Y <= parseInt(wheel.Window.Screen.WorkingArea.Height *1/2)) {//上1/2窗口
         ScreenBrightness.ScreenBrightness.Adjust("5+");}
         else if(wheel.Y >= parseInt(wheel.Window.Rectangle.Bottom) - 50) {//下50像素
         sp.SendVKey(vk.VOLUME_MUTE)}
         else{//下1/2窗口
         sp.SendVKey(vk.VOLUME_UP)}
   }else{//滚轮向下
        if(wheel.Y <= parseInt(wheel.Window.Screen.WorkingArea.Height *1/2)) {
        ScreenBrightness.ScreenBrightness.Adjust("5-"); }
        else if(wheel.Y >= parseInt(wheel.Window.Rectangle.Bottom) - 50) {
         sp.SendVKey(vk.VOLUME_MUTE)}
        else{
        sp.SendVKey(vk.VOLUME_DOWN)}
    }
}

liuxilu  
#17 Posted : Sunday, February 12, 2023 3:45:44 AM(UTC)
liuxilu

Rank: Advanced Member

Reputation:

Groups: Translators, Moderators, Approved
Joined: 4/6/2020(UTC)
Posts: 79
China

Thanks: 1 times
Was thanked: 21 time(s) in 21 post(s)
Originally Posted by: 2014218866 Go to Quoted Post
Hello, dear friends. I don't know how to solve the problem when I encounter it. Would anyone like to help me? Thank you very much. When the computer is working, I divide the computer screen into upper and lower areas, with Word in the upper half and Excel in the lower half. S+can only change the screen brightness when the mouse is used on Word. S+can only change the volume, when the mouse is used on Excel. The script can work normally only when the window is maximized. I don't know why. The code is as follows


wheel.Window.Screen是窗口所在屏幕
新问题应该发新贴
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.