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 : Friday, July 24, 2020 2:10:02 AM(UTC)
Theinvoker

Rank: Member

Reputation:

Groups: Approved
Joined: 3/24/2020(UTC)
Posts: 25
Italy
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.
Rob  
#2 Posted : Sunday, August 2, 2020 10:44:09 AM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 13 times
Was thanked: 153 time(s) in 132 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.


Rob  
#3 Posted : Sunday, August 2, 2020 10:48:17 AM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 13 times
Was thanked: 153 time(s) in 132 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.
Theinvoker  
#4 Posted : Sunday, August 2, 2020 11:14:06 AM(UTC)
Theinvoker

Rank: Member

Reputation:

Groups: Approved
Joined: 3/24/2020(UTC)
Posts: 25
Italy
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 11:19:16 AM(UTC)  | Reason: Not specified

Rob  
#5 Posted : Monday, August 3, 2020 6:55:22 AM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 13 times
Was thanked: 153 time(s) in 132 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.
Theinvoker  
#6 Posted : Tuesday, August 4, 2020 10:41:45 AM(UTC)
Theinvoker

Rank: Member

Reputation:

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

Thanks: 2 times
Thanks

WIth all these commands moved to gestures i can consider mice with less buttons.
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.