Rank: Advanced Member
Groups: Approved
Joined: 3/24/2020(UTC) Posts: 37 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
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,359 Location: Tampa, FL Thanks: 28 times Was thanked: 419 time(s) in 356 post(s)
|
You can use the Left Click and Mouse Wheel events to handle this. Global Actions > Mouse Events > Left ClickCheck Enabled, leave Consume uncheckedCode://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 WheelCode://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);
}
}
|
|
|
|
Rank: Member
Groups: Approved
Joined: 8/8/2020(UTC) Posts: 12 Thanks: 1 times
|
The mouse wheel is not working after done that.
How to make the default mouse wheel available?
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,359 Location: Tampa, FL Thanks: 28 times Was thanked: 419 time(s) in 356 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);
}
|
|
|
|
Rank: Member
Groups: Approved
Joined: 8/8/2020(UTC) Posts: 12 Thanks: 1 times
|
One more question.
How to set the different action on left mouse button+Mouse wheel?
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,359 Location: Tampa, FL Thanks: 28 times Was thanked: 419 time(s) in 356 post(s)
|
Originally Posted by: Thaworn 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);
}
|
|
|
|
Rank: Member
Groups: Approved
Joined: 8/8/2020(UTC) Posts: 12 Thanks: 1 times
|
I mean different action for another application/program.
(Sorry, I didn't ask you clearly.)
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,359 Location: Tampa, FL Thanks: 28 times Was thanked: 419 time(s) in 356 post(s)
|
|
|
|
|
Rank: Member
Groups: Approved
Joined: 8/8/2020(UTC) Posts: 12 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.
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,359 Location: Tampa, FL Thanks: 28 times Was thanked: 419 time(s) in 356 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
|
|
|
|
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.
Important Information:
The StrokesPlus.net Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close