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

Notification

Icon
Error

Options
Go to last post Go to first unread
enfantreble  
#1 Posted : Tuesday, May 24, 2022 9:37:58 PM(UTC)
enfantreble

Rank: Newbie

Reputation:

Groups: Approved
Joined: 5/10/2022(UTC)
Posts: 8
Japan
Location: Tokyo

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Hi all,
And Rob congrats on the awesome product. Im amazed it does't have a wider adoption!
I've been reading the forums like nuts in random order, and progarming for the last 2 days, and i have soo many ideas! I have acouple of questions that would help me get started, pls point me to the right documentaiton (im sure it exists from what i've seen).
I've been using the chrome mouse gestures plugin (https://forum.strokesplus.net/posts/t8434-Searching-text-file-contents-in-background) pretty much since i can got my hand o chome, I dont remeber useing it without SOftGestures. I've aso been tweaking with a lot of things (powertoys, Total Commander, Powershell, ahk), but it never occured to me that I could have mouse gestures outside the browser! Add the power of .net behind it, and this is pretty much the soltion to all my problems!
I've beem messing around with windows 11 since day 1 when it was a POS UI wise (I'm still super pissed about not having a proper taskbar OR toolbar! or even decent widgets. Guess what, I will probalby be able to make my own in a couple of days, based on a sample I've see in here, a fulscreen HTML with buttons on it (as i've said, just read anything in front of me)...I can have my own widget summonable anwyhere anytime, with whatever I want on it... wow.. just need some sleep, maybe some time off...
If you can pls point me to what you think may be relevant information to get me ramp up faster, Il be happy to read it. I have so many idea, and soo little time.. 've read all the formal documentaiton I've found, but I think the real gems are in the forums.
Q: How do i stop locking myself out? Eg: typed on characted in ForegroundWindowChange, and saved, so tooke me 10 mins to get back focus and save. Happened several times, I'm betting better at it, but I feel there's got to be a stop the world button?
Q: I'm planing to log everything in the console until I get beter understanding of things, (and syntax omg and typos)m but I've seen a short video on a different topic, where the guy demoing was pretty much displayin every click on screen, with a little transaprent mouse icon, and all the sequence of events with DisplayTextInfo i assume... That's way bettter than any logging... I can't find it right now, but I thought that's awesome, was wondering if that's somehwing like a debug mode, so I don't have to log all my stuff muyself. There's some really dodgey thngs going on with my windows after messing around with it for too long (uninstalled some .net runtimes, and nothing's been the same ever since), and have some display issues due to monitor scaling, so the donsole window is retty messed up, not even sure what it's supposed to do. (see atttached) I have programing knwoledge, but zero .net.
.

Q: Not a gamer, but I've been using mouse for the last few days coincodentally. I can do a lot of things in it, it has LUA, but otherwise it's pertty limited, especially compared to .Net. Now the gesture range is pretty much endless, but I feel that it woudl be a bit of a waste to let all tlose buttons unused. It has 11, pls a conveniently placed modifier, so they say 22. Not gonna use all of those, but some buttons are pretty convenient. I can deal with X1 and X2, made the horizontal scrollwheel work at soem point, but the other buttons aren't readable by any appplication, other than the mouse...
Mouse
So I've been sending exotic keystrokes to S+, and treat evertyhing there. I can probably do better with using F13-F24 or stuff like that, coz I've already locked myself out whne stumbliong on another hook in Powertoys... I can't imagine how these messages can and are intercepted and I've tried, a lot), but I think it makes sense to "Centralize" all the actins (code) in S+. What would be the best option here, to commmunicate? Is there anythgin outside VKies, like, ppipes, natine windows signals, so they don't get stuck or itnerfere with other flows. Any words of wisdom here, would be appreciated.
I've also have 6 uselsss "favourite"buttons on my Microsoft Ergonomic 4000 keyboard that nobody can read, except the MS app, and that's striight out terrible, and I gave it enough chances - but not cointing on using that. Gestures are unlimited.
I need to get some sleep, it's almost 7am herre, but this is gonna be couple of itnesive weeks for me!

Also, because of the said windows issues, the windows native cliplbard snipper takes 1-5 seconds to show up, and the next 5 I've tried were not lucky, I thogut that could be a good staritng project for me. Any resources or basic example (ourside the one wher you need actiually crop the rectange myself by mouse)..
Then a clipbard manager, I haven't found a good one yet...

Anaywa, thanks, this is already been a trip for me.
randomConstant  
#2 Posted : Wednesday, May 25, 2022 8:03:59 AM(UTC)
randomConstant

Rank: Advanced Member

Reputation:

Groups: Translators, Approved
Joined: 7/17/2021(UTC)
Posts: 135

Thanks: 35 times
Was thanked: 18 time(s) in 15 post(s)
Hi there

Thank you in advance for all the cool stuff you're going to share Laugh

Yes, it is a miracle and we almost feel stupid for not wanting such a utility (S+) before, I also found S+ when looking for Opera's mouse gestures alternative.

For the locking out part, if you mean getting stuck somewhere due to S+ gestures, following might help:
Code:
sp.Reload(); //to reload S+, gets rid of most deadlocks for me

Code:
sp.StopAllScripts(); //haven't used but name sounds.. promising

You can have such emergency gestures as hot keys and enable the option "keep registered hot keys active when disabled" from the advanced settings, this will let you execute hotkeys even when S+ is disabled.

Speaking of disabled, you can disable S+ gestures using a hotkey with the following code:
Code:
if(StrokesPlus.StoredValues.Booleans.Get("ProgramDisableFlag")) {
StrokesPlus.StoredValues.Booleans.Set("ProgramDisableFlag", false);
sp.CreateTimer('sPlusEnableTimer', 100, -1, String.raw`sp.Enable();sp.DeleteTimer('sPlusEnableTimer');`);
}else{
StrokesPlus.StoredValues.Booleans.Set("ProgramDisableFlag", true);
sp.Disable();
}

It is helpful when playing games which require holding down and moving LMB.

As for the extra buttons on the mouse and keyboard, I know its tempting but I suggest you try to make efficient gestures for the two main mouse buttons and extend their functionality as needed. Mainly because most mouse only have those two buttons and you don't want to be crippled when using someone else's machine. But I'm guessing you have crazy amount of gestures so for your particular case it might be better to use more.

Welcome to the forums, I'm a noob myself but Rob is always there to help, hope you have a great time. Laugh
Rob  
#3 Posted : Wednesday, May 25, 2022 2:37:28 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)
Quote:
Q: How do i stop locking myself out?

Yeah, you have to be really careful when working in the Foreground Window Change! Honestly, this is a tough one and pretty much comes down to making sure you code the script with a built-in method to stop itself - or get the StrokesPlus Settings or Console window to have focus, since the script won't be executed if S+ is the active process (WINEVENT_SKIPOWNPROCESS).

For example, your script could see if the Control key is being held and to ignore, or count how many times within the last X seconds and skip, could make a hotkey that stores a variable which the script looks for (press hotkey > set variable> Foreground script sees variable and skips execution)...basically what randomConstant said!

Quote:
Q: I'm planing to log everything in the console

Yes, you can do that. There's also the trace build which you can use to log a TON of things S+ can track.

Regarding the scaling, yeah WinForms really doesn't like text size scaling above 100% - I'm (slowly...) working on replacing the UI with HTML/CSS/js - but I'll try to look at the console window and see if I can add some more containers/etc to help with scaling.

Quote:
Q: Not a gamer, but I've been using mouse for the last few days coincodentally.

Only 5 buttons are support/seen by Windows without a driver acting as mediator: Left, Middle, Right, X1, X2.

So the only thing you can do is assign those extra buttons to be hotkeys which are defined in S+ - so the mouse software sends the hotkey and S+ sees the keys being pressed and executes.


Quote:
What would be the best option here, to commmunicate? Is there anythgin outside VKies, like, ppipes, natine windows signals, so they don't get stuck or itnerfere with other flows. Any words of wisdom here, would be appreciated.

You can send scripts to S+ via SendMessage using the WM_COPYDATA message.

You can also call StrokesPlus.net.exe -script={script}:
Code:
C:\Program Files\StrokesPlus.net\StrokesPlus.net.exe script=sp.MessageBox('test','test');

So you could create a function in the Global Actions > Load/Unload > Load tab which invokes the desired script, like:
Code:
function externalScript(name) {
    switch(name) {
        case "doSomething":
            //code here
            break;
        ....etc
    }
}
//call: C:\Program Files\StrokesPlus.net\StrokesPlus.net.exe script=externalScript("doSomething");

See this post for some info on using the Macros area as a repository for scripts.

Quote:
Then a clipbard manager, I haven't found a good one yet...

I've used Ditto and CopyQ with success.
Rob  
#4 Posted : Wednesday, May 25, 2022 2:48:52 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)
Quote:
What would be the best option here, to commmunicate? Is there anythgin outside VKies, like, ppipes, natine windows signals, so they don't get stuck or itnerfere with other flows. Any words of wisdom here, would be appreciated.
You could also make your own S+ plugin! BigGrin
Rob  
#5 Posted : Wednesday, May 25, 2022 2:55:29 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)
Another tip: If you hold the Control key while S+ is starting it disables all hooks and scripts. This lets you open the Settings and make changes, then close and reopen S+.
thanks 1 user thanked Rob for this useful post.
randomConstant on 5/25/2022(UTC)
enfantreble  
#6 Posted : Wednesday, May 25, 2022 11:20:11 PM(UTC)
enfantreble

Rank: Newbie

Reputation:

Groups: Approved
Joined: 5/10/2022(UTC)
Posts: 8
Japan
Location: Tokyo

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Thanks guys, this is awesome!
Quote:
Quote:
sp.Reload(); //to reload S+, gets rid of most deadlocks for me

Yea, this is a good hotkey to have under your belt, but that's not the trouble. Seems like pressing Ctrl-Alt-Delete breaks (some) loops, whhile the others kind of die by themselves after ~20 seconds, from my limited experience.

Quote:
As for the extra buttons on the mouse and keyboard, I know its tempting but I suggest you try to make efficient gestures


Of course I don't need them, but stuff like that motiveates me (or gets me banging my head against the wall). So I guess for now that's next purpose in life.
Rocks and mods, not to mention floaters that haven't understood their full extent... virtually unlimited (?) range of shapes (the reciignition is amazig, i tested something close to a @ sign).
Small hiccup, brief testing shows it's not that easy to send modifiers from X3+... That's bascally it, there's one (G-Mod) button right under your thumb at all times, so if I could map that the Alt or something without hiccup, i'd be happy. But then again, once/if I have that solved, i got all the others solved.
I hope it's a matter of timing/delays. More testing to come.
I remember I saw some option to allow games to contorl the mouse LED colors, so I guess there may be ways to send input TO the quintesential input device after all. Yea, @Rob that could be my plugin, everybody uses the mouse LEDs for IPC. It's not unlike a registry... so it would back to the basics, to hell with messages, file locks, I guess even the using the clipboard would work...

Quote:
StrokesPlus Settings or Console window to have focus, since the script won't be executed if S+ is the active process (WINEVENT_SKIPOWNPROCESS).

Yep, that's the one. I kind of noticed that the console is special, but didn't occur to me to use it to somehow script out of the error. I guess worst case scenario is to stop/pause/kill SP, and edit the typo in config. I'll save that excitement for next time it hapens, later today.

Quote:
There's also the trace build which you can use to log a TON

Yet, tons of stuff.
Code:
26-May-22 06:28:48: ScriptEngine.cs::Execute(): Too Many Script Errors - Successful execution, resetting

Is this something I should be worried about? I got tons of scriptss, but the loggs seem to be dominated by CAPSWatch (which is to be expected, feels like at least a couple of other scripts should be triggered, even if I'm not doing things, so Im worried errror are getting swallowed in that line somehow.

Any chance it's handy to give the trace build a different icon at the next version (I know, bit early for feature requests... But I am software product manager with ADHD, i see cheap improvements everywhere).

Quote:
See this post for some info on using the Macros area as a repository for scripts.

Yep, that was my next question, if loading any functions at onLoad would make them available everywhere? The thing is syntax is really killing my productivity, i've never writen 1 line of JS or .Net in my life, not to mention dinstinguishing between them propertly in this ClearType mix. Poor typing and ADHD is not a good mix, I need all the help I can get in terms of code completion and predictions (so I don't have to google a "for loop"), for anything that's not a CLI (and even that has to be fancy
So Im hoping to edit in VScode functions, just refresh from SP (with a hotkey), one function per hook, unless you have some better ideas. I thing the SP GUI is probably is a client for the .Net server, who's doing all the heavy lifting, but getting into that mix would be too much much, just to avoid the GUI. I think the bits that I have to type things in the GUI will come to an end soon, so I'll be doing the actual dev work in external scripts loaded via onLoad.
There's probably a way to inject the speciffic scripts/hooks directly, I'd be happy with channeling everyhting thgouh onLoad.
If you're gonna tell me you have a VSCode plugin for this, then you've really thgought of everything.


Quote:
Regarding the scaling, yeah WinForms really doesn't like text size scaling above 100% - I'm (slowly...) working on replacing the UI with HTML/CSS/js - but I'll try to look at the console window and see if I can add some more containers/etc to help with scaling.

Pls don't bother unless other people report it, my mess is kind of unique: i've got 4 montors diferent that are pretty much all different, is swiched the primary since installation form unscaled to scaled, and I don't think Windows figured that out yet, so now the window's look depends on which monitor it was born, and when, It's pretty much random. Everyth second update of NVdia drivers breaks Gsync (ive got 165, 120, 90, 60) so daily driver crashes mean monitors reinit in random order, and windowds get replaced and rescaled on a best effort basis... At some point I thought reinstalling .net and VC runtimes was a good idea, but things were never the same again, some windows native apps take 1-5 seconds to start. I'm pretty sure I just deleted all c:\Windowns\Fonts and restored them from a Recovery Iso yesterday, and not sure I've rebooted since. Pretty sure any of them can have some contribution. Randomness is the rule til a clean Windows reinstall.

Btw, what's the most aggressive, way to kill a random frozen window, with a gesture? I'm planning to do RunProgram("pskill.exe",exe...) or lookup by title, but if that goes though cmd /c or pwsh, it's gonna become a trip in itself to escape and -Noprofile,.. and I've got a space in my username/home folder, which im more and more convienced is to blame for a lot of things. I'm pretty sure I saw some Kill methods but not if they're actually SIGKILL or what they need to be to get the job done when windows taskmanager is out of ideas.

Edited by user Wednesday, May 25, 2022 11:27:13 PM(UTC)  | Reason: Not specified

Rob  
#7 Posted : Thursday, May 26, 2022 4:18:36 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)
Quote:
Is this something I should be worried about? (Too Many Script Errors - Successful execution, resetting)

No, the first part of the text just tells me the section of code, but it states "successful execution" meaning no issues in that section.

Quote:
Any chance it's handy to give the trace build a different icon at the next version...i see cheap improvements everywhere

I just don't have a lot of personal time, so I try to just focus on the core functionality - if I was getting paid, I'd spend more time on the UI/UX :P

Quote:
tell me you have a VSCode plugin for this

Haha, no VSCode plugin/extension. But yes you can make a folder of scripts and manage in VSCode.
You can use the FileSystemWatcher to watch for the files being saved and eval (execute) the files' contents into each S+ script engine.

Code below assumes the files end in .js!

Put in Global Actions > Load/Unload > Load script tab
Code:
// Load all scripts on load
var scriptsFolder = "C:\\MYSCRIPT_FOLDER\\";
for(var scriptFile of System.IO.Directory.GetFiles(scriptsFolder, "*.js")) {
    try {
        var fileContents = System.IO.File.ReadAllText(scriptFile);
        // exec script into current script engine
        eval(fileContents);
        
        // Execute file contents into all other script engines
        for(var engine of StrokesPlus.ScriptEngine.List) {
            if(engine.Engine.Name != StrokesPlus.ScriptEngine.Current.Engine.Name) {
                if(engine.IsExecuting) {
                    engine.Interrupt();
                }
                engine.Execute(fileContents);
            }
        }
	}		
	catch (err) {
		StrokesPlus.Console.Log('ScriptFile Initial Load: ' + err.message);
	}
}

// Create FileSystemWatcher to look for script file changes
// Only install in last script engine
if(__spEngineWrapper.Engine.Name == StrokesPlus.ScriptEngine.List.Last().Engine.Name)
{
    // Only create if it doesn't already exist
    if(StrokesPlus.StoredValues.Objects.Get("ScriptFileWatcher") != null)
    {
        var scriptWatcher = new System.IO.FileSystemWatcher();
        //Set the path to the target folder where the file will exist
        scriptWatcher.Path = scriptsFolder;
        //Only watch .js files, no others in the directory
        scriptWatcher.Filter = "*.js";
        //Only subscribe to file write operations
        scriptWatcher.NotifyFilter = System.IO.NotifyFilters.LastWrite;
        //Create the event handler which is called when the file(s) are changed
        var scriptChangedEvent = scriptWatcher.Changed.connect(
            function (sender, fileChangedEvent) {
                try
                {
                    sp.Sleep(50);
					var fileContents = System.IO.File.ReadAllText(fileChangedEvent.FullPath);
					// exec script into current script engine
					eval(fileContents);
					
					// Execute file contents into all other script engines
					for(var engine of StrokesPlus.ScriptEngine.List) {
						if(engine.Engine.Name != StrokesPlus.ScriptEngine.Current.Engine.Name) {
							if(engine.IsExecuting) {
								engine.Interrupt();
							}
							engine.Execute(fileContents);
						}
					}				
                }
                catch (err) {
					StrokesPlus.Console.Log('ScriptFileWatcher: ' + err.message);
				}
            }
        );
        //Start the file watcher
        scriptWatcher.EnableRaisingEvents = true;
        //Store the file watcher and Changed event objects for any future reference needs
		StrokesPlus.StoredValues.Objects.Set("ScriptFileChangedEvent", scriptChangedEvent);
        StrokesPlus.StoredValues.Objects.Set("ScriptFileWatcher", scriptWatcher);
    }
}

Quote:
what's the most aggressive, way to kill a random frozen window, with a gesture?

Process.Kill() is the best thing you can do from S+ - if the Task Manager won't kill a process, though, it's unlikely you'll have better luck here.
Code:
// from Action
action.Window.Process.Kill();

// against the currently active window
sp.ForegroundWindow().Process.Kill();

Edited by user Friday, May 27, 2022 4:08:52 AM(UTC)  | Reason: Fixed missing bracket

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.