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

Notification

Icon
Error

Options
Go to last post Go to first unread
Theinvoker  
#1 Posted : Saturday, August 15, 2020 7:58:38 AM(UTC)
Theinvoker

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 3/24/2020(UTC)
Posts: 37
Italy
Location: Milano

Thanks: 2 times
I need to use a secondary button to do that gesture you told me to control volume (Button+ Scroll Wheel)
Sometimes i have to use mouse with my left hand and it's more comfortable if that gesture is Left Button + Scroll Wheel instead of the primary Right Button.

But i need Left Button only for that gesture and i don't want secondary button to be always active. i use left click to move video players (and windows in general when they are not maximized) but if i set left click as secondary button then it always try to do some gesture and it moves windows only when i release buttons
Rob  
#2 Posted : Wednesday, August 19, 2020 12:06:52 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)
You can use the Left Click and Mouse Wheel events to handle this.

Global Actions > Mouse Events > Left Click

Check Enabled, leave Consume unchecked
Code:
//On left button down store a variable that the Mouse Wheel script looks for, on release delete it
if(click.Down) {
    sp.StoreBool("VolumeScrollActive", true)
} else {
    sp.DeleteStoredBool("VolumeScrollActive")
}


Global Actions > Mouse Events > Mouse Wheel
Code:
//If variable from Left Click script is set, the left button is down, so change volume
if(sp.GetStoredBool("VolumeScrollActive")) {
    //wheel.Delta is a positive or negative number, indicating the direction the wheel was scrolled
    if(wheel.Delta > 0) {
        sp.SendVKey(vk.VOLUME_UP);
    } else {
        sp.SendVKey(vk.VOLUME_DOWN);
    }
}
Thaworn  
#3 Posted : Thursday, October 15, 2020 10:15:12 AM(UTC)
Thaworn

Rank: Member

Reputation:

Groups: Approved
Joined: 8/8/2020(UTC)
Posts: 12
Thailand

Thanks: 1 times
The mouse wheel is not working after done that.

How to make the default mouse wheel available?
Rob  
#4 Posted : Thursday, October 15, 2020 12:07:03 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)
Just have it inject the mouse wheel if it's not in the volume logic.

Code:
//If variable from Left Click script is set, the left button is down, so change volume
if(sp.GetStoredBool("VolumeScrollActive")) {
    //wheel.Delta is a positive or negative number, indicating the direction the wheel was scrolled
    if(wheel.Delta > 0) {
        sp.SendVKey(vk.VOLUME_UP);
    } else {
        sp.SendVKey(vk.VOLUME_DOWN);
    }
} else {
    //Not in volume logic, relay the mouse wheel event
    sp.MouseWheel(wheel.Point, false, wheel.Delta);
}
Thaworn  
#5 Posted : Thursday, October 15, 2020 10:17:51 PM(UTC)
Thaworn

Rank: Member

Reputation:

Groups: Approved
Joined: 8/8/2020(UTC)
Posts: 12
Thailand

Thanks: 1 times
One more question.

How to set the different action on left mouse button+Mouse wheel?
Rob  
#6 Posted : Friday, October 16, 2020 12:25:56 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)
Originally Posted by: Thaworn Go to Quoted Post
One more question.

How to set the different action on left mouse button+Mouse wheel?

Just change the code inside the first block:
Code:
//If variable from Left Click script is set, the left button is down, so change volume
if(sp.GetStoredBool("VolumeScrollActive")) {
    //wheel.Delta is a positive or negative number, indicating the direction the wheel was scrolled
    if(wheel.Delta > 0) {
        //TODO: Wheel scrolled up, do something here
    } else {
        //TODO: Wheel scrolled down, do something here
    }
} else {
    //Not in volume logic, relay the mouse wheel event
    sp.MouseWheel(wheel.Point, false, wheel.Delta);
}
Thaworn  
#7 Posted : Saturday, October 24, 2020 7:54:52 PM(UTC)
Thaworn

Rank: Member

Reputation:

Groups: Approved
Joined: 8/8/2020(UTC)
Posts: 12
Thailand

Thanks: 1 times
I mean different action for another application/program.

(Sorry, I didn't ask you clearly.)

Rob  
#8 Posted : Sunday, October 25, 2020 2:37:54 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)
You can use similar logic to what I posted to your other request:

https://forum.strokesplus.net/posts/m11602-How-to-change-stroke-button-on-specific-application
Thaworn  
#9 Posted : Friday, November 6, 2020 3:03:22 AM(UTC)
Thaworn

Rank: Member

Reputation:

Groups: Approved
Joined: 8/8/2020(UTC)
Posts: 12
Thailand

Thanks: 1 times
I want to use Left Mouse Click + Middle Mouse Click to open new tab in foreground in Chrome, could you please show me the code?

If I get the correct code, I think I will understand how to use it and don't have to ask you so many questions in the future.
Thank you for every of your replies.
Rob  
#10 Posted : Friday, November 6, 2020 4:30:02 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)
Use this script in

Global Actions > Mouse Events > Middle Click

(Check Enabled and Consume Click Event)
Code:
// If this is the middle button down event (not up/release)
// AND the Left button is being held down
// AND the window below the mouse is Chrome
if(click.Down 
   && (sp.GetKeyState(vk.LBUTTON) & 0x8000) 
   && click.Window.Process.MainModule.ModuleName == "chrome.exe"
  )
{
    //Send Ctrl+T to open new tab
    sp.SendModifiedVKeys([vk.LCONTROL], [vk.VK_T]);
}
else
{
    //Send the middle click as normal
    sp.MouseClick(click.Point, MouseButtons.Middle, click.Down, !click.Down); 
}

Note that you must first press and hold the Left button before pressing the Middle button.

Edited by user Friday, November 6, 2020 4:36:10 PM(UTC)  | Reason: Not specified

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.