StrokesPlus.net Forum
»
General Discussion
»
Feature Requests
»
App-specific definitions - multiple assignments
Rank: Advanced Member
Groups: Approved
Joined: 10/26/2020(UTC) Posts: 50 ![Germany Germany](/Content/images/flags/DE.png) 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
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,382 ![United States United States](/Content/images/flags/US.png) Location: Tampa, FL Thanks: 28 times Was thanked: 430 time(s) in 363 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?
|
|
|
|
Rank: Advanced Member
Groups: Approved
Joined: 10/26/2020(UTC) Posts: 50 ![Germany Germany](/Content/images/flags/DE.png) 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?
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,382 ![United States United States](/Content/images/flags/US.png) Location: Tampa, FL Thanks: 28 times Was thanked: 430 time(s) in 363 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](/Themes/BlueGrey/heart_small.png) 1 user thanked Rob for this useful post.
|
|
|
Rank: Advanced Member
Groups: Approved
Joined: 10/26/2020(UTC) Posts: 50 ![Germany Germany](/Content/images/flags/DE.png) 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.
|
|
|
|
Rank: Newbie
Groups: Approved
Joined: 3/26/2024(UTC) Posts: 5 ![United States United States](/Content/images/flags/US.png) Location: Washington Thanks: 2 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
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,382 ![United States United States](/Content/images/flags/US.png) Location: Tampa, FL Thanks: 28 times Was thanked: 430 time(s) in 363 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()
|
![thanks](/Themes/BlueGrey/heart_small.png) 1 user thanked Rob for this useful post.
|
|
|
Rank: Newbie
Groups: Approved
Joined: 3/26/2024(UTC) Posts: 5 ![United States United States](/Content/images/flags/US.png) Location: Washington Thanks: 2 times
|
This is an absolute game changer. That's exactly what I've been thinking about in the back of my mind for days! I've got an older logitech wave keyboard and all the F keys have an 'Fn' alternative option. With strokesplus and the other tools I've been adopting I haven't really found much of a use for them and have been wondering what the perfect use for them would be. None of these applications will recognize the signal they are putting out, but the app they come with allows them to execute files so I was already thinking if I could figure out some way to make hitting Fn+F1, Fn+F2, etc. execute AHK scripts that would swap out my strokes+ config file then I'm pretty much set with a row of 10 configurations across the top of my keyboard. But I was honestly thinking, maaaaan, my dumb ass is gonna take forever to figure it out 😂
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,382 ![United States United States](/Content/images/flags/US.png) Location: Tampa, FL Thanks: 28 times Was thanked: 430 time(s) in 363 post(s)
|
It's absolutely possible! In fact, you don't have to swap config files, that's just one way that is pretty simple to grasp conceptually. You could very much have your conditions in the script itself, like an action that checks to see what mode (e.g. which Fn+Fx was last pressed), and the logic in the action behaves differently. For example, in your keyboard app, have Fn+F1 execute: Code:C:\Program Files\StrokesPlus.net\StrokesPlus.net.exe --script=sp.StoreString("FnMode", "F1");
Then in your action script, you check the mode and do different things: Code://Get the stored string, set by the Fn+Fx keypress triggered by the keyboard software
var mode = sp.GetStoredString("FnMode");
switch(mode)
{
case "F1":
sp.MessageBox("F1 thing here!", "FnMode");
break;
case "F2":
sp.MessageBox("F2 stuff here!", "FnMode");
break;
default:
sp.MessageBox("No mode set!", "FnMode");
}
So in that case, you don't have to have different S+ config files, it's all in your single configuration, the logic is just inside the actions themselves. This is just one of probably a dozen different ways this could be accomplished!
|
|
|
|
Rank: Newbie
Groups: Approved
Joined: 3/26/2024(UTC) Posts: 5 ![United States United States](/Content/images/flags/US.png) Location: Washington Thanks: 2 times
|
Well sir, I know my strengths and I know my weaknesses. I have no qualm telling you that I am a toddler when it comes to coding, I follow the concept of what you're saying, but knowing me I'll most certainly spend hours trying to make it work only to find out that I forgot to put a semicolon somewhere. But I definitely appreciate all that you do, and I know when I start working again this is going to be an absolute game changer to my work flow. It's a very very long story that I'm not going to dive into now, but the first half of this year has been a lot of hardships. I wish I could donate to you in fact, but right now I'm barely keeping the lights on around here. Anyway, you're probably wondering why I'm randomly wandering off into this tangent. It's to let you know that, again, I know my strengths and weaknesses. By trade I'm a professional video editor and graphic designer. Considered by many to be one of the best. I saw a post where you jokingly said that "you're no graphic designer". Lol, well I'm no coder. But since I'm grateful for what you've created here and shared with all of us, soon as I'm up and running again, If you need a cosmetic overhaul on some graphics, I don't think it would take too much effort for me to throw something together for you. Also, I have become more and more interested in coding and UI design. I don't think I could skin an app all by myself. But with someone as good at coding as you, and someone as good at graphic design as me, I guarantee you could have this application looking super duper official. I'll plant that seed and leave it at that for now. P.S. Someone in my Adobe Experts group (I'm in the Adobe Experts program as a specialist in photoshop, after effects, and premiere) was randomly debating with another person in the group about mice vs trackpads. and I stumbled in on him making this joke: "Trackball master race Be smart. Spend life touching balls. Good for wrist." Anyway, you're sure to get a kick out of my response. 1 because it was a funny clapback to his dirty joke (see title of video), 2 because I was showing off my strokesplus software and 3 you can see a glimpse of the wallpaper I recently designed, and the design of my web browser etc. (I'm in the process of re-installing my system and a complete rebranding, again, first half of this year is a long story, but there ya go.) ?si=DGlwzD5W4SnmClnx
|
|
|
|
StrokesPlus.net Forum
»
General Discussion
»
Feature Requests
»
App-specific definitions - multiple assignments
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