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

Notification

Icon
Error

Options
Go to last post Go to first unread
Rob Otter  
#1 Posted : Thursday, October 29, 2020 5:40:37 PM(UTC)
Rob Otter

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 10/26/2020(UTC)
Posts: 50
Germany
Location: Darmstadt

Thanks: 15 times
Was thanked: 2 time(s) in 2 post(s)
Maybe I am missing something?

I know I can define gestures (action lists) and text expansions per application and can use Module name (exe) with Regex to match the gesture set on multiple apps.

But if multiple gesture sets match the same app (because it is specified in their Module name (exe)), all gesture sets after the first one matching do not work for the application.
It seems like S+ terminates searching for app definition after the first match. Without this stopping, it would be very easy to just define a gesture set like "Tabbing", "Texting", "Tabbing 2" (different hotkeys, same stroke) and then assign an app to a mixture of these.

I could write a thousand words more to explain in more detail why this would be very useful (at least for the way I imagine the usage) but maybe it´s not necessary - ask again if my question is still unclear.

Regards,
Rob Otter
Rob  
#2 Posted : Thursday, October 29, 2020 6:10:10 PM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 28 times
Was thanked: 419 time(s) in 356 post(s)
Yes, it stops searching for other apps once an app is matched. I'm not sure I'm following your issue or request about this.

Are you saying you'd have multiple applications (as defined in S+) which could match on the same criteria?
But that each of those applications have different gesture sets defined, so you'd want it to match a combination of gesture/application?

If so, I can say that's not something which will be easily changed. Plus, I don't believe two application definitions should be able to be matched for the same criteria (module, etc.) as that seems counter-intuitive/confusing.

Would you provide some additional example scenarios so I can better understand the overall objective?
Rob Otter  
#3 Posted : Friday, October 30, 2020 7:06:41 AM(UTC)
Rob Otter

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 10/26/2020(UTC)
Posts: 50
Germany
Location: Darmstadt

Thanks: 15 times
Was thanked: 2 time(s) in 2 post(s)
Yes, I need to make that more clear... Example:

- Several applications use tabs (Browsers, text editors, Excel ("Sheets"), even my Windows Explorer is enhanced using QtTabBar)
In each application I´d like to use the same gestures to switch between tabs, closing / unclosing / re-ordering them, etc. Up to this point, I could use global gestures and specify the appropriate hotkey for each command. But some apps need different hotkeys, e.g. closing a tab in Notepad++ uses Ctrl-W (as many other editors do) while most browsers use Ctrl-F4. Switching between tabs is often done with Alt-Left/Right, but to switch Sheets in Excel, it requires Ctrl-PgUp/PgDown.
There are many more examples. So I have to configure full sets of gestures for nearly each app individually, although 90% of their gestures are the same.

- This is just one aspect. Gestures for basic text functions is another one (e.g. I use "right-to-left" for Backspace, "left-to-right" for Space, "upperLeft-to-lowerRight" for Enter). This can be used in every text editor but not in Browsers (except when focus is on a text area). So, I can hardly define a full set of gestures matching two or more applications because they all will differ to a small amount.

- Up to now, I have not even talked about Text Expansion, which has the same "problem", but to a higher extent. Some text editors I use for programming where text abbreviations like "br" would expand to "<br/>" or "span" to "<span></span>{8x LEFT}", but in others (like MS Word) that I use solely for real text, "span" shall not be expanded and "br" may expanded to something else (the german "Berechtigung" in this case).

Of course, I can define one set covering the least common actions (which will be very, very small), make a copy of it for every new application and then add the missing actions specific for that app. But even if I would have to add only 2-3 actions, it is quite uncomfortable and, what is more uncomfortable, when I want to add a new gesture / text expansion, I need to manually add it to _all_ fitting applications.

All in all, if all application sets would be checked (and the last matching gesture / text expansion would be used), such sets could be seen more as functionality-specific and less as application-specific.

Or am I missing a very basic method of accomplishing this and spn is covering all this already in another way?
Rob  
#4 Posted : Friday, October 30, 2020 1:48:26 PM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 28 times
Was thanked: 419 time(s) in 356 post(s)
Okay, I see what you're getting at.

However, the core of S+ is very centered around a single matching application (or ignored app, they both inherit from the same class) or defaulting to Global if no app match. There was never any intent of supporting multiple matching applications as it complicates things and wasn't something I thought would make sense logically.

So the way the core of the application is written, that's simply not going to happen, at least not anytime soon! It would essentially require a massive rewrite of the application and I don't think the value is there for such an undertaking when an alternative exists.

You basically just need to define these at the Global level, since they're really not specific to an application as S+ sees things.

For text expansions, that would mean using the Automation method and crafting the necessary logic to handle the different applications. For example:
Code:
var fgWindowEXE = sp.ForegroundWindow().Process.MainModule.ModuleName;

switch(fgWindowEXE)
{
    case "chrome.exe":
        sp.SendKeys("Chrome");
        break;
    case "notepad++.exe":
        sp.SendKeys("Notepad Plus Plus");
        break;
    default:
        sp.SendKeys("default");
} 

It's really no different for handling tabs for different applications in the Global actions. Just check action.Window.Process.MainModule.ModuleName instead.
thanks 1 user thanked Rob for this useful post.
Rob Otter on 11/2/2020(UTC)
Rob Otter  
#5 Posted : Monday, November 2, 2020 8:29:25 AM(UTC)
Rob Otter

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 10/26/2020(UTC)
Posts: 50
Germany
Location: Darmstadt

Thanks: 15 times
Was thanked: 2 time(s) in 2 post(s)
Thanks, I feared I have to work around like that. But anyway I started to do so in a quite modular way using your example as a starting point. Once I have a code base that I am satisfied with, I´ll share that to all users, hoping it might be of help.
tony.zed  
#6 Posted : Wednesday, April 17, 2024 1:23:33 AM(UTC)
tony.zed

Rank: Newbie

Reputation:

Groups: Approved
Joined: 3/26/2024(UTC)
Posts: 3
United States
Location: Washington

Thanks: 1 times
I know this is a 3 year old thread and everyone has probably long since moved on with their life, lol. But fresh learning how to use strokesplus, stumbled upon this and couldn't help but to want to throw my two cents in, since I am contemplating some of the same challenges. My approach will likely be along the lines of creating autohotkey commands that will dictate the rule set to follow via the strokesplus console. You can import/export those spexport configuration files in the program, and since it has a console interface it's a safe bet you can import/export those configuration files through a command line as well. So I'll create multiple configuration files, and from there set some keyboard autohotkey shortcuts assigned to load each. End goal: even though I'll be in the same application, my web browser the entire time, I hit F1 and it's now configured for youtube, I hit f2 and now it's configured for gmail, hit F3 and now it's configured for online spreadsheets, and so on. That is my working theory. I'll avoid programming the swap to be signaled by the mouse itself, as executing a gesture that is simultaneously re-assigning all the gestures sounds like I'm just asking for trouble. But having a variety of configuration files to hot swap via keypad seems like it'd do alright. I could even throw in a pre-toggle off / post-toggle on for book ends if I want to be on the safe side. during the transition. all in theory so far of course.

Edited by user Wednesday, April 17, 2024 1:27:05 AM(UTC)  | Reason: Not specified

Rob  
#7 Posted : Wednesday, April 17, 2024 3:18:36 AM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 28 times
Was thanked: 419 time(s) in 356 post(s)
Along those lines, you can use different copies of the StrokesPlus.net.json file, which will be in the same folder as S+ if portable, or in app data (C:\Users\{USER_NAME}\AppData\Roaming\StrokesPlus.net)

So setup S+ how you want it for YouTube, and copy the file, naming it like StrokesPlus.net.YouTube.json, and repeat for each variation.

Then you can create hotkeys in S+ to switch between configs.

So let's say you just have YouTube and Default configs, files you would setup in your settings location:

  • StrokesPlus.net.json
  • StrokesPlus.net.Default.json
  • StrokesPlus.net.YouTube.json

StrokesPlus.net.json is the current file S+ is using.


Hotkey F1 - YouTube Config

Code:
//Find the current S+ config file
//*************************************
var destPath = "";
var spPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);

if (File.Exists(`${spPath}\StrokesPlus.net.json`))
{
    destPath = `${spPath}\StrokesPlus.net.json`;
}
else if (File.Exists(System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData), "StrokesPlus.net", "StrokesPlus.net.json")))
{
    destPath = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData), "StrokesPlus.net", "StrokesPlus.net.json");
}

// Set the file to the YouTube config
var sourcePath = destPath.replace(/StrokesPlus\.net\.json/, 'StrokesPlus.YouTube.json');

// For logging/debug purposes
// ******************************
//StrokesPlus.Console.Log(sourcePath);
//StrokesPlus.Console.Log(destPath);

// Copy the desired config to overwrite the standard StrokesPlus.net.json file
System.IO.File.Copy(sourcePath, destPath, true);

// Reload S+, reading the new file
sp.Reload();


Hotkey F2 - Default Config

Code:
//Find the current S+ config file
//*************************************
var destPath = "";
var spPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);

if (File.Exists(`${spPath}\StrokesPlus.net.json`))
{
    destPath = `${spPath}\StrokesPlus.net.json`;
}
else if (File.Exists(System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData), "StrokesPlus.net", "StrokesPlus.net.json")))
{
    destPath = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData), "StrokesPlus.net", "StrokesPlus.net.json");
}

// Set the file to the Default config
var sourcePath = destPath.replace(/StrokesPlus\.net\.json/, 'StrokesPlus.net.Default.json');

// For logging/debug purposes
// ******************************
//StrokesPlus.Console.Log(sourcePath);
//StrokesPlus.Console.Log(destPath);

// Copy the desired config to overwrite the standard StrokesPlus.net.json file
System.IO.File.Copy(sourcePath, destPath, true);

// Reload S+, reading the new file
sp.Reload();



FYI, you can also execute scripts via CLI:
Code:

C:\Program Files\StrokesPlus.net\StrokesPlus.net.exe --script=sp.Reload()
Users browsing this topic
Guest
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.