Rank: Advanced Member
Groups: Approved
Joined: 3/24/2020(UTC) Posts: 37 Location: Milano Thanks: 2 times
|
is it possible to use a gesture to increase and decrease volume in media players?
setting the shortcut that players have to control volume to a gesture (let's say Up and Down) it works but it just changes volume for 1 single step (1% or 5% or else, depending on the software) I would like the gesture to keep changing volume until i stop the gesture
i don't know if it's clear what i want, sorry for bad explanation.
|
|
|
|
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)
|
So we can't do this while drawing the gesture since that would interfere with the normal gesture recognition process. But you can accomplish this using a timer and Left Click release. Create your volume action and check the Left Button as a modifier, use this script Code://Action script (USE LEFT BUTTON AS MODIFIER, HOLD LEFT AND MOVE MOUSE UP AND DOWN, THEN RELEASE LEFT)
if(!sp.GetStoredBool("VolumeActive")) {
sp.StoreBool("VolumeActive", true);
sp.StorePoint("VolumeChangeLastPoint",sp.GetCurrentMousePoint());
//Create timer that executes every 100 milliseconds to watch the mouse location and change the volume
sp.CreateTimer("VolumeChange",
0,
100,
` var movementThreshold = 10; //number of pixels needed to trigger next volume step up/down
var lastMousePt = sp.GetStoredPoint("VolumeChangeLastPoint");
var mousePt = sp.GetCurrentMousePoint();
if(mousePt.Y < lastMousePt.Y - movementThreshold) {
//Mouse moving up, increase volume
sp.SendVKey(vk.VOLUME_UP);
sp.StorePoint("VolumeChangeLastPoint",mousePt);
} else if(mousePt.Y > lastMousePt.Y + movementThreshold){
//Mouse moving down, iderease volume
sp.SendVKey(vk.VOLUME_DOWN);
sp.StorePoint("VolumeChangeLastPoint",mousePt);
}
`);
}
Next, go to Global Actions > Mouse Events > Left Click - check the Enabled box and add this script: Code:if(!click.Down && sp.GetStoredBool("VolumeActive")) {
sp.DeleteTimer("VolumeChange");
sp.DeleteStoredBool("VolumeActive");
sp.DeleteStoredPoint("VolumeChangeLastPoint");
}
Now, draw your gesture and press AND hold the left button, continue holding left after releasing the stroke button. When you release the stroke button, the gesture is recognized and the script executes, starting the timer which watches the mouse location and increases or decreases the volume based on the mouse moving up or down. The Left Click script waits until you release the Left button and stops the timer script.
|
|
|
|
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)
|
Note that you can also create two actions which use the mouse wheel to change the volume up and down (that's what I use).
Make sure in the Options > Advanced section you check this box: Enable Recognition on Mouse Wheel Scroll
Then have one action use Wheel Up as a modifier, and another one with Wheel Down as a modifier (both use the same gesture, or none).
I have no gesture defined for both of these actions, so I simply hold the right button and scroll the mouse wheel up or down to change the volume.
|
|
|
|
Rank: Advanced Member
Groups: Approved
Joined: 3/24/2020(UTC) Posts: 37 Location: Milano Thanks: 2 times
|
what i requested seems more complicated I like your solution, thanks But i have a question. Using scroll wheel to Copy and paste, i see that i keep pasting if i keep scrolling... Can i just paste one single time for each scroll (not conting how far i go with the wheel) Edited by user Sunday, August 2, 2020 5:19:16 PM(UTC)
| Reason: Not specified
|
|
|
|
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 leverage stored variables and the release event to handle this, while keeping the ability to have other actions allow multiple scrolls. In your action script: Code:if(!sp.GetStoredBool("pasteComplete")) {
sp.SendModifiedVKeys([vk.LCONTROL], [vk.VK_V]);
sp.StoreBool("pasteComplete", true);
}
In Global Actions > Mouse Events > Release script (check Enabled if not already active): Code:sp.DeleteStoredBool("pasteComplete");
This will only send paste once then store a variable to prevent additional paste events until one of the stroke buttons is released.
|
|
|
|
Rank: Advanced Member
Groups: Approved
Joined: 3/24/2020(UTC) Posts: 37 Location: Milano Thanks: 2 times
|
Thanks
WIth all these commands moved to gestures i can consider mice with less buttons.
|
|
|
|
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