Rank: Advanced Member
Groups: Approved
Joined: 3/24/2020(UTC) Posts: 37 Location: Milano Thanks: 2 times
|
Is it possible to disable secondary button for some applications?
I need it to have more gestures only for video players bot not for other things
|
|
|
|
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 handle that via script in the Global Actions > Window Events > Foreground Window Change tab. Something like this: Code://If Chrome, set secondary stroke button to middle, otherwise disable secondary stroke button
if(sp.ForegroundWindow().Title.indexOf("- Google Chrome") > -1) {
sp_config.SecondaryStrokeButton = MouseButtons.Middle;
} else {
sp_config.SecondaryStrokeButton = MouseButtons.None;
}
|
|
|
|
Rank: Advanced Member
Groups: Approved
Joined: 3/24/2020(UTC) Posts: 37 Location: Milano Thanks: 2 times
|
EDIT it's not working. i need to know the exact name to put where you put "Google chrome". how do i get it? Edited by user Wednesday, June 3, 2020 3:19:25 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)
|
This was just an example, you'd need to make updates as needed to handle each of the applications you want to allow the secondary stroke button for. This script is just looking for the existence of a partial string match in the foreground window's title. You could use that (combining multiple strings to match), or EXE names. You can call this when the window is active to get the full title, but you would usually just want to match on a non-variable part of the title so it doesn't fail to match if the caption changes a little (like an active document, etc.) sp.MessageBox(sp.ForegroundWindow().Title, "Foreground Window Title");This will get the EXE name of the foreground window: sp.ForegroundWindow().Process.MainModule.ModuleName For example: Code://If Chrome or Notepad++ is the foreground (active) window,
//enable middle mouse as secondary stroke button, otherwise disable secondary
if(sp.ForegroundWindow().Process.MainModule.ModuleName == "chrome.exe"
|| sp.ForegroundWindow().Process.MainModule.ModuleName == "notepad++.exe"){
sp_config.SecondaryStrokeButton = MouseButtons.Middle;
} else {
sp_config.SecondaryStrokeButton = MouseButtons.None;
}
|
|
|
|
Rank: Advanced Member
Groups: Approved
Joined: 3/24/2020(UTC) Posts: 37 Location: Milano Thanks: 2 times
|
i know nothing about this so when you rite i just copy
And it's not working, sorry i just changed chrome.exe withthe app i need PotPlayerMini64.exe
I enabled "use secondary button" in app ---> action list
|
|
|
|
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)
|
This works fine for me: Code:try
{
if(sp.ForegroundWindow().Process.MainModule.ModuleName == "chrome.exe"
|| sp.ForegroundWindow().Process.MainModule.ModuleName == "PotPlayerMini64.exe"){
sp_config.SecondaryStrokeButton = MouseButtons.Middle;
} else {
sp_config.SecondaryStrokeButton = MouseButtons.None;
}
}
catch {}
Of course, make sure to change MouseButtons.Middle to whatever mouse button you want to use as your secondary.
|
|
|
|
Rank: Advanced Member
Groups: Approved
Joined: 3/24/2020(UTC) Posts: 37 Location: Milano Thanks: 2 times
|
Nothing happens
|
|
|
|
Rank: Advanced Member
Groups: Approved
Joined: 3/24/2020(UTC) Posts: 37 Location: Milano Thanks: 2 times
|
i tried to activate "draw gestures" and now i sse that using middle button on potplayer drwas a red line, that is good because red is for secondary button But i don't understand why it doesn't perfmorm ALT+Arrow command A second problem is that i have 2 monitors and when i change from having both on or just one, this script stop working and i have to restart strokesplus EDIT i found the problem. it was in app definition for potplayer. But i found a new problem Usually gestures work even if the window i want to move it is not selected before. I mean...let's say i'm on firefox on monitor 1 and i have potplayer fullscreen on monitor 2. if i use a gesture on potplayer with primary button, it works perfectly just because potplayer was below the cursor. But if i use the secondary button, with the script, it doesn't work the first time. the first time is needed to take focus of that window and then the gesture works. I would like to have the same behavior i have when i use primary button Edited by user Thursday, June 4, 2020 9:05:24 AM(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)
|
That's because the script which enables the secondary button only executes when the foreground (active) window changes.
So until PotPlayer is the active window, the secondary button is not enabled - there's no easy way around this since you don't want the secondary active in other applications. To configure stroke buttons based on the window below the cursor would require a major rewrite of S+ and is not something I am considering at this point in time due to the amount of work involved and that it would affect performance since S+ would constantly be examining windows every time the mouse moves.
Why it works the second time is because the secondary button is being clicked on PotPlayer just as if S+ was not running, which causes PotPlayer to become activated, this then executes the foreground window change script which enables the secondary button.
|
|
|
|
Rank: Advanced Member
Groups: Approved
Joined: 3/24/2020(UTC) Posts: 37 Location: Milano Thanks: 2 times
|
Ok it's still useful. if i want to use mouse buttons to do same thing (next or previous video) i have to select potplayer window, only a different way to do the same thing
|
|
|
|
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