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

Notification

Icon
Error

Options
Go to last post Go to first unread
G47S53  
#1 Posted : Monday, July 31, 2023 7:32:26 AM(UTC)
G47S53

Rank: Newbie

Reputation:

Groups: Approved
Joined: 7/31/2023(UTC)
Posts: 2
France, Metropolitan

Hello,

I want to send messages to a mqtt broker. I can send a message when a gesture is made but I would also like to send a message simply when the application is in front (selected, but without gesture).

Rob  
#2 Posted : Monday, July 31, 2023 1:40:42 PM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 28 times
Was thanked: 431 time(s) in 364 post(s)
You can use Global Actions > Window Events > Foreground Window Change.
This gets executed every time a window becomes active - e.g. switching back and forth between apps would execute this each time a different app becomes the active window.
Code:
try {
    var currentWindow = sp.ForegroundWindow();
    var exeName = currentWindow.ExecutableName.toLowerCase();
    if (exeName == "mqtt_app.exe") {
        //Do something here
    }
} catch (err) {
    StrokesPlus.Console.Log(`Error getting FG window info: FG window title: ${sp.ForegroundWindow().Title}`);
}
G47S53  
#3 Posted : Monday, July 31, 2023 3:45:03 PM(UTC)
G47S53

Rank: Newbie

Reputation:

Groups: Approved
Joined: 7/31/2023(UTC)
Posts: 2
France, Metropolitan

Big thanks!

I am a little confused because I had not seen this function.
Strokesplus is really good soft!

Best regards



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.