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

Notification

Icon
Error

Options
Go to last post Go to first unread
Roland  
#1 Posted : Tuesday, June 25, 2019 6:27:32 AM(UTC)
Roland

Rank: Member

Reputation:

Groups: Translators, Approved
Joined: 11/7/2018(UTC)
Posts: 15
Germany

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
I'd like to put hotkeys on my extra mouse buttons X1 and X2 so I can switch between different desktops (CTRL+WIN+LEFT and CTRL+WIN+RIGHT).

It works ok, but the hotkeys are sent TWICE, one when I press the mouse button, one when I release it.

The script is this:
sp.SendModifiedVKeys([vk.LCONTROL,vk.LWIN], [vk.LEFT]); // or "RIGHT"

I tried other hotkeys and they are always sent twice.

thanks 1 user thanked Roland for this useful post.
beholder on 8/9/2019(UTC)
Rob  
#2 Posted : Tuesday, June 25, 2019 7:20:12 AM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 5 times
Was thanked: 78 time(s) in 68 post(s)
Do you have this script in your X1/X2 Click Scripts?

If so, this is not a bug, you just need to qualify the event. The script gets executed when the mouse button is pressed down, then again when released as someone may want to leverage things in a more complicated way.

Code:
//Only fire on mouse down
if(click.Down) {
    sp.SendModifiedVKeys([vk.LCONTROL,vk.LWIN], [vk.LEFT]); // or "RIGHT"
}


Code:
//Only fire on mouse up
if(!click.Down) {
    sp.SendModifiedVKeys([vk.LCONTROL,vk.LWIN], [vk.LEFT]); // or "RIGHT"
}

Roland  
#3 Posted : Tuesday, June 25, 2019 7:58:14 AM(UTC)
Roland

Rank: Member

Reputation:

Groups: Translators, Approved
Joined: 11/7/2018(UTC)
Posts: 15
Germany

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Ah!!!
Much better!

Thank you :)
2014218866  
#4 Posted : Thursday, June 27, 2019 9:05:48 AM(UTC)
2014218866

Rank: Advanced Member

Reputation:

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

Thanks: 9 times
Dear Rob, the default function of my X1 in the mouse is backward.
Can you disable the backward function when executing the script mentioned above?
Rob  
#5 Posted : Thursday, June 27, 2019 10:14:49 AM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 5 times
Was thanked: 78 time(s) in 68 post(s)
Unfortunately, these click scripts to not interfere with the mouse button messages, so Windows (or the mouse driver) will still receive them and respond.

You may need to find where the forward/backward are bound for the mouse and disable them.

I might consider adding that as an option, to just absorb mouse events for certain buttons.
2014218866  
#6 Posted : Thursday, June 27, 2019 5:05:44 PM(UTC)
2014218866

Rank: Advanced Member

Reputation:

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

Thanks: 9 times
Yeah,Rob,thanks
beholder  
#7 Posted : Saturday, August 10, 2019 7:04:55 PM(UTC)
beholder

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 8/9/2019(UTC)
Posts: 86
Slovakia

Thanks: 6 times
Originally Posted by: Rob Go to Quoted Post
Unfortunately, these click scripts to not interfere with the mouse button messages, so Windows (or the mouse driver) will still receive them and respond.

You may need to find where the forward/backward are bound for the mouse and disable them.

I might consider adding that as an option, to just absorb mouse events for certain buttons.


Hey, this actually needs to be done for some software to function properly with StrokesPlus.net. Some software does not allow customizing [for example spefically] the X1 and X2 mouse buttons. Programmers simply hard-coded the functions for these buttons and it cannot be changed in any way. We need a way to intercept those buttons' clicks and stop them from propagating. I think that another "hooking" software, Event Ghost, has a specific action just for this, it's called Stop Processing Event, although I am not sure if it pertains only to EG processing of the event -- or ANY processing of the event in other software.

Old Opera 12 on a medium-fast computer with StrokesPlus.net installed creates a problem with X1 and X2 button clicks when they are being clicked really fast. They not only register as a StrokesPlus.net actions but also as clicks inside Opera 12, which then goes forward/back in the page history. This is unwanted and Event Ghost can do this properly.

So perhaps I can suggest a similar command which would bring us a way to stop further processing of the mouse button clicks that were just intercepted.

Rob  
#8 Posted : Saturday, August 10, 2019 7:46:15 PM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 5 times
Was thanked: 78 time(s) in 68 post(s)
I agree, it's actually on my to-do list.
Rob  
#9 Posted : Wednesday, August 14, 2019 12:27:49 PM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 5 times
Was thanked: 78 time(s) in 68 post(s)
Added Consume Click Event checkboxes in 0.3.3.3
beholder  
#10 Posted : Wednesday, August 14, 2019 5:44:59 PM(UTC)
beholder

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 8/9/2019(UTC)
Posts: 86
Slovakia

Thanks: 6 times
Originally Posted by: Rob Go to Quoted Post
Added Consume Click Event checkboxes in 0.3.3.3


Thank you very much, I'll get to testing within 24 hours.
beholder  
#11 Posted : Friday, August 16, 2019 6:31:26 AM(UTC)
beholder

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 8/9/2019(UTC)
Posts: 86
Slovakia

Thanks: 6 times
Originally Posted by: Rob Go to Quoted Post
Added Consume Click Event checkboxes in 0.3.3.3


testing goes really well but I have just realized there might be something missing. What if I have a game that uses the two X1 and X2 buttons? Won't they be converted to keystrokes/actions of strokesplus.net? In this case they should not be converted, actually.

So I guess what is missing is the ability to assign actions to mouse buttons PER APPLICATION, because we may want to use them differently in different applications. Right now, even if I somehow modified the actions' script to distinguish between applications after clicking, the mouse click would still be consumed anyway (I thought you would make a script command but you made it as a checkbox -- which is FINE for global usage but could be detrimental for individual app usage).

Other than that it works great so far. No hiccups yet, but we will see, it's still too early to say. Event Ghost hooks usually bug out on this within 2-3 days of use, so more time is needed for testing.
Rob  
#12 Posted : Friday, August 16, 2019 6:56:34 AM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 5 times
Was thanked: 78 time(s) in 68 post(s)
Like everything, it always gets complicated and very per user :)

The structure of the code doesn't easily lend itself to this request without major changes to the core code, however, you can still handle it via Global > Window Events > Foreground Window Change script.

Code:
if(TODO_LOGIC_TO_DETERMINE_IF_APP_IS_THE_GAME) {
    sp_config.FireOnX1Click = false;
    sp_config.ConsumeX1Click = false;
    sp_config.FireOnX2Click = false;
    sp_config.ConsumeX2Click = false;
} else {
    sp_config.FireOnX1Click = true;
    sp_config.ConsumeX1Click = true;
    sp_config.FireOnX2Click = true;
    sp_config.ConsumeX2Click = true;
}

Essentially, this will toggle off the X1/X2 scripts and click consume checkboxes if the foreground window meets the criteria (which still needs to be added), otherwise it enabled them. If your game uses those buttons, it's best that S+ not process them at all. You could actually send the mouse click directly from the script if it is the game using sp.MouseClick(click.Point, click.Button, click.Down, !click.Down); - but for a game, that's going to introduce slight delays which may be noticeable.

This section is great to control things which are not app level, for example you could change ignore/stroke keys, disable certain global actions, really about anything you want.

Edited by user Friday, August 16, 2019 7:01:08 AM(UTC)  | Reason: Not specified

Rob  
#13 Posted : Friday, August 16, 2019 6:58:38 AM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 5 times
Was thanked: 78 time(s) in 68 post(s)
Oh, in the window change script, use sp.ForegroundWindow() to perform the logic for seeing if it's a game or whatever. There is no action object available in that script.
Rob  
#14 Posted : Friday, August 16, 2019 7:05:42 AM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 5 times
Was thanked: 78 time(s) in 68 post(s)
I can't make it a script command (well, not practical anyway) since the script fires immediately and on a new thread. It's best practice to very quickly process hooked events and call the next hook so as to not slow down input or in the case of an error in script, the hook would get evicted by Windows since it didn't receive a response and would also lock up the mouse until Windows evicted the hook.
beholder  
#15 Posted : Sunday, August 18, 2019 5:52:47 PM(UTC)
beholder

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 8/9/2019(UTC)
Posts: 86
Slovakia

Thanks: 6 times
Originally Posted by: Rob Go to Quoted Post
Oh, in the window change script, use sp.ForegroundWindow() to perform the logic for seeing if it's a game or whatever. There is no action object available in that script.


Ok, so here is the script at Global Actions>>Window Events>>Foreground Window Change I have made using the logic you posted, thank you very much:

Code:
if(sp_config.FireOnX1Click == false && sp.ForegroundWindow().RootWindow.ClassName && sp.ForegroundWindow().RootWindow.ClassName == "OperaWindowClass"){
    sp_config.FireOnX1Click = true;
    sp_config.ConsumeX1Click = true;
    sp_config.FireOnX2Click = true;
    sp_config.ConsumeX2Click = true;
}
if(sp_config.FireOnX1Click == true && (!sp.ForegroundWindow().RootWindow.ClassName || sp.ForegroundWindow().RootWindow.ClassName != "OperaWindowClass")){
    sp_config.FireOnX1Click = false;
    sp_config.ConsumeX1Click = false;
    sp_config.FireOnX2Click = false;
    sp_config.ConsumeX2Click = false;
}


Everything works as it should except one small exception, not sure if it's related to the actual script above: when S+ is up and running try to click the tab of any program in the bottom tray bar (currently running programs - but not the right tray with tiny icons). This should make the program go fullscreen. Then click it again. This should minimize the program. Then click it again to maximize. While doing this, S+ sometimes bugs out with following: https://drive.google.com/open?id=1ycmaZgyJg5jBUYsa80zWA5-EdsTCW6HI

This also triggers the bug mentioned in the other thread where right clicking stops working when S+ is enabled. What is interesting is that it also bugged out in the same way (as if the scripts were running) when S+ was disabled :-O I had to turn off S+ completely to stop it from bugging out.

Anyway, just keep clicking like mad the same bottom tabs in Windows (Win7 here) and it should surface.



Rob  
#16 Posted : Sunday, August 18, 2019 6:51:03 PM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 5 times
Was thanked: 78 time(s) in 68 post(s)
Click which button? Is there an associated X1 or X2 script or something in conjunction with the foreground window script?
beholder  
#17 Posted : Sunday, August 18, 2019 10:12:19 PM(UTC)
beholder

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 8/9/2019(UTC)
Posts: 86
Slovakia

Thanks: 6 times
Originally Posted by: Rob Go to Quoted Post
Click which button? Is there an associated X1 or X2 script or something in conjunction with the foreground window script?


Click Left Mouse button (i.e. maximize and minimize window by clicking a program tab on bottom). Sorry for not being precise.

As for associated scripts, yes, there are, of course. But nothing special. Just this:
Code:
if(click.Down) {
    sp.SendKeys("{PgUp}");
}


I can easily break it by the above described clicking, so if you can't make it appear, I can make you a report with a debug version within 24 hours.
Rob  
#18 Posted : Monday, August 19, 2019 7:41:13 AM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 5 times
Was thanked: 78 time(s) in 68 post(s)
Try 0.3.3.4.

The SystemWindow code (which I borrowed from another project) was throwing a zero error ("The operation completed successfully") if the WinAPI GetClassName function returned zero.
Now it just returns an empty string instead of raising an error.
Rob  
#19 Posted : Monday, August 19, 2019 7:44:01 AM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 5 times
Was thanked: 78 time(s) in 68 post(s)
Oh also, not that it should really matter, but I would use this code instead as it's far more efficient (less code calls for each reference):

Code:
var className = sp.ForegroundWindow().RootWindow.ClassName;
if(sp_config.FireOnX1Click == false && className && className == "OperaWindowClass"){
    sp_config.FireOnX1Click = true;
    sp_config.ConsumeX1Click = true;
    sp_config.FireOnX2Click = true;
    sp_config.ConsumeX2Click = true;
}
if(sp_config.FireOnX1Click == true && (!className || className != "OperaWindowClass")){
    sp_config.FireOnX1Click = false;
    sp_config.ConsumeX1Click = false;
    sp_config.FireOnX2Click = false;
    sp_config.ConsumeX2Click = false;
}

Edited by user Monday, August 19, 2019 7:51:43 AM(UTC)  | Reason: Updated to further reduce API calls

thanks 1 user thanked Rob for this useful post.
beholder on 8/19/2019(UTC)
beholder  
#20 Posted : Monday, August 19, 2019 3:08:38 PM(UTC)
beholder

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 8/9/2019(UTC)
Posts: 86
Slovakia

Thanks: 6 times
Originally Posted by: Rob Go to Quoted Post
Oh also, not that it should really matter, but I would use this code instead as it's far more efficient (less code calls for each reference):

Code:
var className = sp.ForegroundWindow().RootWindow.ClassName;
if(sp_config.FireOnX1Click == false && className && className == "OperaWindowClass"){
    sp_config.FireOnX1Click = true;
    sp_config.ConsumeX1Click = true;
    sp_config.FireOnX2Click = true;
    sp_config.ConsumeX2Click = true;
}
if(sp_config.FireOnX1Click == true && (!className || className != "OperaWindowClass")){
    sp_config.FireOnX1Click = false;
    sp_config.ConsumeX1Click = false;
    sp_config.FireOnX2Click = false;
    sp_config.ConsumeX2Click = false;
}


Hey, thanks for the modified code and for the fix. Works flawlessly now. Still testing though, too early to tell.
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.