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

Notification

Icon
Error

Options
Go to last post Go to first unread
2014218866  
#1 Posted : Sunday, December 29, 2019 3:44:21 AM(UTC)
2014218866

Rank: Advanced Member

Reputation:

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

Thanks: 10 times
Dear Rob,

when I use the right button as the mouse gesture key, the right-click script will not work. As a new feature, can s + enable right-click scripting (if this feature causes an exception, S + can also limit the time of clicking). Also we consider enabling wheel key click scripts when the wheel key is used as a secondary gesture key.

I look forward to your reply.
Rob  
#2 Posted : Monday, December 30, 2019 6:41:58 AM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 5 times
Was thanked: 116 time(s) in 103 post(s)
I've made an update in 0.3.7.6 to allow this. However, only the button Down event is triggered in the click script, you will have to use the Release script to handle the button Up event.

Right Click
Code:
//Right Click script
if(click.Down) {
    sp.MessageBox("Down", "Down");
} else {
    //Up event, this will never happen for stroke buttons
    //Use Release tab
}


Release
Code:
//Release script
if(click.Button == MouseButtons.Right) {
    //There is no Down event for the Release event
    sp.MessageBox("Up", "Up");
}
2014218866  
#3 Posted : Monday, December 30, 2019 8:37:13 AM(UTC)
2014218866

Rank: Advanced Member

Reputation:

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

Thanks: 10 times
Thank you for improving S +, Rob.
Now I have a problem. In word.exe, I want to realize such a function: select text continuously by X1 (after X1 click, Ctrl is pressed), and change font color by drawing "V" with the right mouse button (release Ctrl by right clicking the script at the same time). But when S + executes the latter, it will cancel the selected text and cannot change the font color. I don't know how to avoid this situation. Can you help me?

Here is the X1 script


Code:
if(!click.Down) {
    //If Control is down from previous click
    if(sp.GetStoredBool("ControlDown")) {
        sp.SendControlUp();
        sp.DeleteStoredBool("ControlDown");
    } else {
        //First click, send control down
        sp.StoreBool("ControlDown", true); 
        sp.SendControlDown();
    }
}


Right click script

Code:
 if(click.Down) {
//   If Control or Shift is down from previous click
    if(sp.GetStoredBool("ControlDown")) {
        sp.SendControlUp();
       sp.DeleteStoredBool("ControlDown");}
}



Script of changing font color in word

Code:
sp.SendAltDown()
sp.SendKeys("h")
sp.SendAltUp()
sp.SendString('i');
var distance = parseInt(Math.sqrt(Math.pow((action.End.X - action.Start.X), 2.0) + Math.pow((action.End.Y - action.Start.Y), 2.0)));
//the distance between the gesture start and end points,not the length of the line itself

if(distance < 30) {
sp.SendKeys("{ENTER}")
} else{
sp.SendKeys("{Left}")
sp.SendKeys("{Left}")
sp.SendKeys("{ENTER}")
}
//sp.MessageBox(distance, "Total Distance");

Rob  
#4 Posted : Monday, December 30, 2019 11:05:23 AM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 5 times
Was thanked: 116 time(s) in 103 post(s)
I tried your scripts and it worked fine for me.

But note that for the V (change color) action, I had to have Control as the modifier for the action, since the Control key is being held down after pressing X1.

2014218866  
#5 Posted : Wednesday, January 1, 2020 4:58:37 PM(UTC)
2014218866

Rank: Advanced Member

Reputation:

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

Thanks: 10 times
Hi, Rob..
Thank you for your reply. Now I use the wheel as the secondary gesture key, but you know that the wheel key has a good function. When it is pressed and dragged down, the page to be viewed will turn down. I want to know whether S + can realize the default function of the mouse wheel key in the global gesture when it is used as the secondary gesture key. For example, in Google, the function of scrolling down an arrow is the same as when it is not used as a secondary gesture key, that is, the page scrolls down.
If this function cannot be realized in the global gesture, can s + realize the following function. In S +, when the scroll wheel draws a V, S + performs the copy function (only this gesture uses the scroll wheel as the secondary gesture key, and other gestures use the right key as the gesture key). However, when the wheel does not draw V (any other shape), the S + wheel key performs the default function of the mouse.
Rob  
#6 Posted : Thursday, January 2, 2020 7:32:51 AM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 5 times
Was thanked: 116 time(s) in 103 post(s)
Unfortunately that is not something which can be reasonably accomplished within S+ in a way that doesn't have complications. There's no way to know the user's intention in advance, and Chrome reacts immediately to the button being held down.

However, single-pressing the middle (wheel) does toggle a scrolling mode in Chrome, then you simply press the button again to exit the scrolling mode. Yes, it is not exactly the same, but is pretty close.

There might be some overly complicated way to make this somewhat work, but it's not something I will add to S+ itself as it's a very specific use case and one that feels like it will be problematic and/or confusing to implement as well as convey to users.

But, if you enable your middle click script and release scripts, I think you can accomplish this with the following scripts. However, the page will scroll while you're drawing.

Middle Click Script
Code:
sp.MouseClick(click.Point, click.Button, true, false); //Send only middle mouse button Down


Release Script
Code:
if(click.Button == MouseButtons.Middle) {
    sp.MouseClick(click.Point, click.Button, false, true); //Send middle mouse button Up
}

2014218866  
#7 Posted : Thursday, January 2, 2020 8:34:25 PM(UTC)
2014218866

Rank: Advanced Member

Reputation:

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

Thanks: 10 times
Thank you for your reply, Rob
Your script is very easy to use and is suitable for my computer. There is no need for you to make improvements to S +. Thank you again.
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.