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

Notification

Icon
Error

Options
Go to last post Go to first unread
ssCtrl  
#1 Posted : Tuesday, August 24, 2021 8:41:17 AM(UTC)
ssCtrl

Rank: Newbie

Reputation:

Groups: Approved
Joined: 8/11/2021(UTC)
Posts: 3

Thanks: 1 times
How to disable only mouse painting and not keyboard in an application?

我想在我的游戏中, 禁用右键绘画, 但是想保留文本扩展

I want to disable right-click painting in my game, but I want to keep the Text Expansion

谢谢 thank you




Rob  
#2 Posted : Tuesday, August 24, 2021 1:44:08 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,349
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 416 time(s) in 354 post(s)
Start by adding this to your Global Actions > Window Events > Foreground Window Change:
Code:
var wndTitle = sp.ForegroundWindow().Title;
StrokesPlus.Console.Log(`Title: ${wndTitle}`, "Foreground Window Change");

Right-click the S+ tray icon and select Console, then click the User tab. This will show you the log entries each time you make a different window active.
Open your game, then check the console to see the title of the game's window.

In my example, I'm using Notepad, so I see this in the Console:
Code:
2021-08-24 09:34:41.19: [Foreground Window Change] Title: StrokesPlus.net Settings
2021-08-24 09:34:45.15: [Foreground Window Change] Title: *Untitled - Notepad

I comment out the console log line, then take the *Untitled - Notepad window title and use this script:
Code:
var wndTitle = sp.ForegroundWindow().Title;
//StrokesPlus.Console.Log(`Title: ${wndTitle}`, "Foreground Window Change");
if(wndTitle === "*Untitled - Notepad")
{
    // If Notepad, prevent S+ from intercepting mouse input
    StrokesPlus.Input.Hooks.Mouse.Active = false;
}
else
{
    // If not Notepad, enable the mouse input interception
    StrokesPlus.Input.Hooks.Mouse.Active = true;
}

So anytime I switch to the Notepad window, mouse input is ignored by S+ and I cannot draw gestures, but Text Expansions will work.
When I switch to a different application, mouse input is again processed by S+.

I have only performed some simple tests, so you may need to refine things. Note that I did not use the EXE name since that is a very resource intensive procedure to get the EXE name, and for scripts like this which are constantly being triggered, I try to avoid that to ensure the script does not affect perforrmance.
thanks 1 user thanked Rob for this useful post.
ssCtrl on 8/24/2021(UTC)
ssCtrl  
#3 Posted : Tuesday, August 24, 2021 4:12:29 PM(UTC)
ssCtrl

Rank: Newbie

Reputation:

Groups: Approved
Joined: 8/11/2021(UTC)
Posts: 3

Thanks: 1 times
It works well
thank you

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.