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  
#1 Posted : Saturday, March 16, 2019 3:28:09 PM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 22 times
Was thanked: 284 time(s) in 247 post(s)
Put this script inside the Global Actions > Mouse Events > Left Click Script to allow Alt+Drag to move window (which is not maximized).
FYI, the click event scripts do not interfere with input, so the Alt key down and release are still received by the window.

Note, this only works starting with version 0.2.9.2, prior versions only executed the click scripts on mouse up.

IMPORTANT: Do not use this (or any timer script, really) without having the Use Script Engine Pool option enabled and a pool size of at least two. I will likely be removing that option, so if I forget to update this post and you don't see the option, don't worry about it!

Code:
if(click.Down) {
    if((sp.GetKeyState(vk.LMENU) & 0x8000) && !sp.GetStoredBool("MoveWindowActive")) {
        if(!click.Window.Maximized) {
            sp.StoreBool("MoveWindowActive", true);
            sp.StoreHandle("MoveWindowHandle", click.Window.HWnd);
            sp.StorePoint("MoveWindowMouseStart", sp.GetCurrentMousePoint());
            sp.StorePoint("MoveWindowStart", click.Window.Location);
            sp.CreateTimer("MoveWindow", 20, 10, String.raw`
                                    var wnd = sp.WindowFromHandle(sp.GetStoredHandle("MoveWindowHandle"));
                                    if(sp.GetKeyState(vk.ESCAPE) & 0x8000) {
                                        wnd.Location = sp.GetStoredPoint("MoveWindowStart");
                                        sp.DeleteTimer("MoveWindow");
                                    }
                                    var startMousePt = sp.GetStoredPoint("MoveWindowMouseStart");
                                    var currMousePt = sp.GetCurrentMousePoint();
                                    var currWinPt = wnd.Location;
                                    if(sp.GetStoredBool("MoveWindowActive")) {
                                        wnd.Location = new Point(currWinPt.X + currMousePt.X - startMousePt.X, currWinPt.Y + currMousePt.Y - startMousePt.Y);
                                    }
                                    sp.StorePoint("MoveWindowMouseStart", currMousePt);
                                `);
        }
    }
} else {
    if(sp.GetStoredBool("MoveWindowActive")) 
    {
        sp.DeleteStoredHandle("MoveWindowHandle");
        sp.DeleteStoredBool("MoveWindowActive");
        sp.DeleteTimer("MoveWindow");
        sp.DeleteStoredPoint("MoveWindowMouseStart");
        sp.DeleteStoredPoint("MoveWindowStart");
    }
}

Edited by user Tuesday, September 10, 2019 2:34:50 AM(UTC)  | Reason: Not specified

thanks 1 user thanked Rob for this useful post.
Matija on 6/14/2021(UTC)
2014218866  
#2 Posted : Saturday, September 7, 2019 2:36:58 AM(UTC)
2014218866

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 5/6/2019(UTC)
Posts: 94
China

Thanks: 17 times
Was thanked: 1 time(s) in 1 post(s)
Dear Rob,

This script doesn't work properly.

When I release the Alt key, the window still moves with the mouse. When I execute the script for the second or third time, the window will not be moved
Rob  
#3 Posted : Saturday, September 7, 2019 3:08:33 AM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 22 times
Was thanked: 284 time(s) in 247 post(s)
Hmm, I just copied the script into my left click script and it works fine. Are you able to provide any additional details which might allow me to reproduce the issue? What other settings do you have, anything like having the Alt be as the ignore key, etc?
2014218866  
#4 Posted : Tuesday, September 10, 2019 1:17:25 AM(UTC)
2014218866

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 5/6/2019(UTC)
Posts: 94
China

Thanks: 17 times
Was thanked: 1 time(s) in 1 post(s)
Dear Rob, this is my configuration file. You can test it.

https://sendit.cloud/dnuqsp181ikt
Rob  
#5 Posted : Tuesday, September 10, 2019 2:33:14 AM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 22 times
Was thanked: 284 time(s) in 247 post(s)
Okay, I was able to reproduce the issue.

Under Options > Advanced, check the Use Script Engine Pool checkbox and enter 2 for Max Script Pool Size.
I use 3, but each engine take a little more memory and system resources, but at least two will ensure you can have multiple scripts able to quickly execute in parallel without trying to use an excessive amount of resources by creating a new one for each execution.

NOTE: You must close and restart S+ after saving that option.

I will look into whether this option should remain or if restrictions need to be applied.

Your config had that unchecked which means every single script execution is spinning up an entire new script engine, loading all of the objects/plug-ins, then executing the script.

The problem is, this script is using a timer which executes every 10 milliseconds. This causes a very large load on the system and is creating a lot of contention, with dozens of script engines being created in less than a half second. I opened Task Manager while doing the Alt+Drag (without the script engine pool checked) and you could see the memory growing very fast.

There is really no good reason to have that option unchecked. I like to give people options, so I wanted to have it available...but I'm thinking that it may not be a good idea. At a minimum, I should probably make it a hidden settings...but even then, it can create a bad user experience and I really think I remove it.
thanks 1 user thanked Rob for this useful post.
2014218866 on 9/10/2019(UTC)
2014218866  
#6 Posted : Tuesday, September 10, 2019 2:53:38 AM(UTC)
2014218866

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 5/6/2019(UTC)
Posts: 94
China

Thanks: 17 times
Was thanked: 1 time(s) in 1 post(s)
Well, you know, for users who don't have script engines, it always prompts "No script engine available; quit the script." Please try again. It really affects experience.
Rob  
#7 Posted : Tuesday, September 10, 2019 4:32:56 AM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 22 times
Was thanked: 284 time(s) in 247 post(s)
Increase your script lock attempts (can't remember exact name, not at the computer). It's a very brief delay between attempts, so you should use a high value. I have mine set to 500 and I only get that message if I'm trying to make it happen.
2014218866  
#8 Posted : Tuesday, September 10, 2019 5:34:17 AM(UTC)
2014218866

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 5/6/2019(UTC)
Posts: 94
China

Thanks: 17 times
Was thanked: 1 time(s) in 1 post(s)
OK, you are right. Thanks a lot.
lyscop  
#9 Posted : Saturday, December 19, 2020 9:22:23 AM(UTC)
soooulp

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 4/23/2020(UTC)
Posts: 89
China

Thanks: 24 times
Was thanked: 4 time(s) in 3 post(s)
Does this script no longer work, Rob.
Rob  
#10 Posted : Sunday, December 20, 2020 12:44:31 AM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 22 times
Was thanked: 284 time(s) in 247 post(s)
I just tried it and it worked fine for me.
What is happening for you?
What settings/options do you have configured that might interfere?
lyscop  
#11 Posted : Sunday, December 20, 2020 1:00:50 PM(UTC)
soooulp

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 4/23/2020(UTC)
Posts: 89
China

Thanks: 24 times
Was thanked: 4 time(s) in 3 post(s)
Originally Posted by: Rob Go to Quoted Post
I just tried it and it worked fine for me.
What is happening for you?
What settings/options do you have configured that might interfere?


It is ok on Win10, last time I tested it on Win7 that can not work, and now I have no problem, thank you replied to me.
Matija  
#12 Posted : Monday, June 14, 2021 11:52:00 AM(UTC)
Matija

Rank: Member

Reputation:

Groups: Approved
Joined: 6/11/2021(UTC)
Posts: 22
Croatia

Thanks: 6 times
Originally Posted by: Rob Go to Quoted Post
Put this script inside the Global Actions > Mouse Events > Left Click Script to allow Alt+Drag to move window (which is not maximized).
FYI, the click event scripts do not interfere with input, so the Alt key down and release are still received by the window.

Note, this only works starting with version 0.2.9.2, prior versions only executed the click scripts on mouse up.

IMPORTANT: Do not use this (or any timer script, really) without having the Use Script Engine Pool option enabled and a pool size of at least two. I will likely be removing that option, so if I forget to update this post and you don't see the option, don't worry about it!

Code:
if(click.Down) {
    if((sp.GetKeyState(vk.LMENU) & 0x8000) && !sp.GetStoredBool("MoveWindowActive")) {
        if(!click.Window.Maximized) {
            sp.StoreBool("MoveWindowActive", true);
            sp.StoreHandle("MoveWindowHandle", click.Window.HWnd);
            sp.StorePoint("MoveWindowMouseStart", sp.GetCurrentMousePoint());
            sp.StorePoint("MoveWindowStart", click.Window.Location);
            sp.CreateTimer("MoveWindow", 20, 10, String.raw`
                                    var wnd = sp.WindowFromHandle(sp.GetStoredHandle("MoveWindowHandle"));
                                    if(sp.GetKeyState(vk.ESCAPE) & 0x8000) {
                                        wnd.Location = sp.GetStoredPoint("MoveWindowStart");
                                        sp.DeleteTimer("MoveWindow");
                                    }
                                    var startMousePt = sp.GetStoredPoint("MoveWindowMouseStart");
                                    var currMousePt = sp.GetCurrentMousePoint();
                                    var currWinPt = wnd.Location;
                                    if(sp.GetStoredBool("MoveWindowActive")) {
                                        wnd.Location = new Point(currWinPt.X + currMousePt.X - startMousePt.X, currWinPt.Y + currMousePt.Y - startMousePt.Y);
                                    }
                                    sp.StorePoint("MoveWindowMouseStart", currMousePt);
                                `);
        }
    }
} else {
    if(sp.GetStoredBool("MoveWindowActive")) 
    {
        sp.DeleteStoredHandle("MoveWindowHandle");
        sp.DeleteStoredBool("MoveWindowActive");
        sp.DeleteTimer("MoveWindow");
        sp.DeleteStoredPoint("MoveWindowMouseStart");
        sp.DeleteStoredPoint("MoveWindowStart");
    }
}



This is quite a nice solution and it works like intended on my Win 10. However, it still has 3 problems:
  1. The mouse pointer moves faster than the window and sometimes ends up being very far from where it should be - this is most prominent when the window changes monitors.
  2. The left click is not consumed, so the window below the pointer responds. If I drag the explorer window, I must be extra cautious where I click because I might unintentionally copy some folder into another folder and not even know about it.
  3. The action requires an additional keypress, so the user has to use a keyboard with another hand. This raises a question whether it would be easier to just click on the title bar and move the window altogether.


I had a nice little script in the old StrokesPlus which you helped me to make to work. And it worked perfectly:

Code:
function dragWindow(wHandle)
	acActivateWindow(wHandle, nil, nil)
	acSetNumber(1)
	local xDelta = acGetMouseLocationX() - acGetWindowLeft(wHandle, nil, nil)
	local yDelta = acGetMouseLocationY() - acGetWindowTop(wHandle, nil, nil)
	while (acGetNumber() == 1) do
		acMoveWindow(wHandle, nil, nil, acGetMouseLocationX()-xDelta, acGetMouseLocationY()-yDelta)
		acDelay(10)
	end
end

dragWindow(acGetParentWindowByPoint(gsx, gsy))


It was activated with Stroke Button + Left Button and it would run as long as the left mouse button was held down. The click would not go through to window itself and the pointer always stayed in the same location relative to the window.
Can at least problems 2. and 3. be solved some way in StrokesPlus.net?

Edited by user Monday, June 14, 2021 11:54:45 AM(UTC)  | Reason: Not specified

Rob  
#13 Posted : Monday, June 14, 2021 12:15:56 PM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 22 times
Was thanked: 284 time(s) in 247 post(s)
Quote:
I had a nice little script in the old StrokesPlus which you helped me to make to work. And it worked perfectly

Here's the equivalent in the new script:

Global Actions > Mouse Events > Left Click
Code:
if(!click.Down) {
    sp.StoreBool("DragWindow", false);
}

Action
assumes Left button is a modifier and is held down after Right button is released
Code:
action.Window.Activate();
sp.StoreBool("DragWindow", true);
var xDelta = sp.GetCurrentMousePoint().X - action.Window.Rectangle.Left;
var yDelta = sp.GetCurrentMousePoint().Y - action.Window.Rectangle.Top;
while (sp.GetStoredBool("DragWindow")) {
	action.Window.Location = new Point(sp.GetCurrentMousePoint().X-xDelta, sp.GetCurrentMousePoint().Y-yDelta);
	sp.Sleep(10);
}

Edited by user Monday, June 14, 2021 12:17:30 PM(UTC)  | Reason: Not specified

thanks 1 user thanked Rob for this useful post.
Matija on 6/14/2021(UTC)
Matija  
#14 Posted : Monday, June 14, 2021 1:37:48 PM(UTC)
Matija

Rank: Member

Reputation:

Groups: Approved
Joined: 6/11/2021(UTC)
Posts: 22
Croatia

Thanks: 6 times
Originally Posted by: Rob Go to Quoted Post
Quote:
I had a nice little script in the old StrokesPlus which you helped me to make to work. And it worked perfectly

Here's the equivalent in the new script:

Global Actions > Mouse Events > Left Click
Code:
if(!click.Down) {
    sp.StoreBool("DragWindow", false);
}

Action
assumes Left button is a modifier and is held down after Right button is released
Code:
action.Window.Activate();
sp.StoreBool("DragWindow", true);
var xDelta = sp.GetCurrentMousePoint().X - action.Window.Rectangle.Left;
var yDelta = sp.GetCurrentMousePoint().Y - action.Window.Rectangle.Top;
while (sp.GetStoredBool("DragWindow")) {
	action.Window.Location = new Point(sp.GetCurrentMousePoint().X-xDelta, sp.GetCurrentMousePoint().Y-yDelta);
	sp.Sleep(10);
}


Damn, it works! I cannot believe it. Now I'm beginning to really like the new version! Thank you for your hard work, Rob.

Matija  
#15 Posted : Thursday, June 17, 2021 10:33:11 PM(UTC)
Matija

Rank: Member

Reputation:

Groups: Approved
Joined: 6/11/2021(UTC)
Posts: 22
Croatia

Thanks: 6 times
It seems that at random times when I use this Drag Window script the window continues to be dragged by the pointer even after I've let go the left mouse button. Obviously, the while-loop doesn't exit. From that point, the only way to stop it is to close S+. I've added the Escape keypress that breaks it, and that works when I use it:

Code:
while (sp.GetStoredBool("DragWindow")) {
    if(sp.GetKeyState(vk.ESCAPE) & 0x8000) {
        sp.StoreBool("DragWindow", false);
    }
    action.Window.Location = new Point(sp.GetCurrentMousePoint().X-xDelta, sp.GetCurrentMousePoint().Y-yDelta);
    sp.Sleep(10);
}


It seems S+ every now and then doesn't notice I've let go a mouse button. Can this be further optimized?
Rob  
#16 Posted : Friday, June 18, 2021 2:39:54 PM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 22 times
Was thanked: 284 time(s) in 247 post(s)
I'm having a challenging time finding out how this is possible (I believe you!)

There are only a couple possibilities where this could happen:
  • The click events have locks around them, so it's possible that somehow it's stuck waiting for a lock to be released
  • The click execution block has an overall lock, which falls into the same category as above
  • There are no available script engines at the time - unlikely, or you'd at least see a message...unless you have sp_config.DisableScriptEngineLockAttemptsExceededMessage set to true - in which case it would try and give up without letting you know


You might want to run the tracing/logging version and see if that helps to identify anything in the log files (which will be quite large!)

Select these trace options:
  • MouseHookGeneralEvents
  • ScriptEngineGeneralEvents
Matija  
#17 Posted : Saturday, June 19, 2021 12:56:33 AM(UTC)
Matija

Rank: Member

Reputation:

Groups: Approved
Joined: 6/11/2021(UTC)
Posts: 22
Croatia

Thanks: 6 times
I've previously tried with Max Script Pool Size: 3 - to no avail. I'm now back on 2. Also - I didn't disabled ScriptEngineLockAttemptsExceededMessage that you mentioned. I do anything manually to the sp_config. This is the full script I'm using:

Code:
if(action.Window.Maximized) {
    sp.StopAllScripts();
}
sp.StoreBool("DragWindow", true);
mInfo('Drag Window', 'lightgreen');
var xDelta = sp.GetCurrentMousePoint().X - action.Window.Rectangle.Left;
var yDelta = sp.GetCurrentMousePoint().Y - action.Window.Rectangle.Top;
while (sp.GetStoredBool("DragWindow")) {
    if(sp.GetKeyState(vk.ESCAPE) & 0x8000) {
        sp.StoreBool("DragWindow", false);
    }
    action.Window.Location = new Point(sp.GetCurrentMousePoint().X-xDelta, sp.GetCurrentMousePoint().Y-yDelta);
    sp.Sleep(10);
}


I did testing 3 times. In the last attempt I had StopAllScripts() part commented out, which can be seen in the log. In all 3 attempts I stopped testing as soon as I hit Escape after the window got stuck on the pointer. All three logs end the same way with the line "ScriptEngine.cs::Execute(): Complete - Script Engine:Execute". Here's the last log:

https://pastebin.com/zDpR2D0j

p.s. I'm not sure what's causing "Too Many Script Errors" either!
Rob  
#18 Posted : Saturday, June 19, 2021 4:10:45 AM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 22 times
Was thanked: 284 time(s) in 247 post(s)
Thanks, this is very helpful.

Give me some time to review and try to reproduce...or at least offer some additional debugging lines to help. There are a couple things that stand out in the logs and following along in the code, so it's a good starting point.

The "Too Many Script Errors" is just a label for the logic area I used to originally add that in, it says "Successful execution, resetting" to indicate there weren't too many errors. I know, it's confusing without understanding how I labelled the messages :)
Rob  
#19 Posted : Saturday, June 19, 2021 11:00:01 PM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 22 times
Was thanked: 284 time(s) in 247 post(s)
Try this download:

https://cdn.strokesplus....Setup_0.4.2.7b_Trace.exe

For the trace options, add ActionEngineGeneralEvents and post the trace logs again. I added some things in the StoredBool methods.
belphegor  
#20 Posted : Sunday, June 20, 2021 2:10:04 PM(UTC)
belphegor

Rank: Newbie

Reputation:

Groups: Approved
Joined: 6/20/2021(UTC)
Posts: 2
China

Originally Posted by: Rob Go to Quoted Post
Put this script inside the Global Actions > Mouse Events > Left Click Script to allow Alt+Drag to move window (which is not maximized).
FYI, the click event scripts do not interfere with input, so the Alt key down and release are still received by the window.

Note, this only works starting with version 0.2.9.2, prior versions only executed the click scripts on mouse up.

IMPORTANT: Do not use this (or any timer script, really) without having the Use Script Engine Pool option enabled and a pool size of at least two. I will likely be removing that option, so if I forget to update this post and you don't see the option, don't worry about it!

Code:
if(click.Down) {
    if((sp.GetKeyState(vk.LMENU) & 0x8000) && !sp.GetStoredBool("MoveWindowActive")) {
        if(!click.Window.Maximized) {
            sp.StoreBool("MoveWindowActive", true);
            sp.StoreHandle("MoveWindowHandle", click.Window.HWnd);
            sp.StorePoint("MoveWindowMouseStart", sp.GetCurrentMousePoint());
            sp.StorePoint("MoveWindowStart", click.Window.Location);
            sp.CreateTimer("MoveWindow", 20, 10, String.raw`
                                    var wnd = sp.WindowFromHandle(sp.GetStoredHandle("MoveWindowHandle"));
                                    if(sp.GetKeyState(vk.ESCAPE) & 0x8000) {
                                        wnd.Location = sp.GetStoredPoint("MoveWindowStart");
                                        sp.DeleteTimer("MoveWindow");
                                    }
                                    var startMousePt = sp.GetStoredPoint("MoveWindowMouseStart");
                                    var currMousePt = sp.GetCurrentMousePoint();
                                    var currWinPt = wnd.Location;
                                    if(sp.GetStoredBool("MoveWindowActive")) {
                                        wnd.Location = new Point(currWinPt.X + currMousePt.X - startMousePt.X, currWinPt.Y + currMousePt.Y - startMousePt.Y);
                                    }
                                    sp.StorePoint("MoveWindowMouseStart", currMousePt);
                                `);
        }
    }
} else {
    if(sp.GetStoredBool("MoveWindowActive")) 
    {
        sp.DeleteStoredHandle("MoveWindowHandle");
        sp.DeleteStoredBool("MoveWindowActive");
        sp.DeleteTimer("MoveWindow");
        sp.DeleteStoredPoint("MoveWindowMouseStart");
        sp.DeleteStoredPoint("MoveWindowStart");
    }
}


thx 4 solving my issue
Matija  
#21 Posted : Sunday, June 20, 2021 2:55:59 PM(UTC)
Matija

Rank: Member

Reputation:

Groups: Approved
Joined: 6/11/2021(UTC)
Posts: 22
Croatia

Thanks: 6 times
Here it is:

https://pastebin.com/utpX89Qy

Same as before, I stopped tracing as soon as I reproduced the error (and hit Esc to stop the script).
Rob  
#22 Posted : Monday, June 21, 2021 1:55:00 PM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 22 times
Was thanked: 284 time(s) in 247 post(s)
So I was finally able to reproduce this, basically trying to initiate the drag window again quickly after already starting it. If you're not doing that on purpose to create the issue, it may be possible your mouse buttons are beginning to fail (clicks twice almost instantly even though you only pressed once).

However, in that scenario, I do get the script error message.

What do you see when you run this?
Code:
sp.MessageBox(sp_config.DisableScriptEngineLockAttemptsExceededMessage, "Script Message");
Matija  
#23 Posted : Monday, June 21, 2021 3:28:36 PM(UTC)
Matija

Rank: Member

Reputation:

Groups: Approved
Joined: 6/11/2021(UTC)
Posts: 22
Croatia

Thanks: 6 times
Originally Posted by: Rob Go to Quoted Post
So I was finally able to reproduce this, basically trying to initiate the drag window again quickly after already starting it. If you're not doing that on purpose to create the issue, it may be possible your mouse buttons are beginning to fail (clicks twice almost instantly even though you only pressed once).

However, in that scenario, I do get the script error message.

What do you see when you run this?
Code:
sp.MessageBox(sp_config.DisableScriptEngineLockAttemptsExceededMessage, "Script Message");


It says "False".

I too have suspected that the mouse button switch may be failing. But, in that case, the dragging script would sometimes stop randomly because while you drag a mouse, your finger wobbles on the button. If the switch was weak, it would suddenly give up and reactivate while I was moving the mouse and that should be enough to exit the while-loop in the script. But that never happened. However, I must say that in the past I've had problems with faulty right button switch (gesture button) which would leave gesture draw marks permanently on screen.

I did initiate drag window quickly several times to reproduce the issue, but it was by hand and I don't think it was fast enough to create the issue by itself. I'm not that fast, lol

Anyway, I'll test again using different mouse and post my results.
Rob  
#24 Posted : Monday, June 21, 2021 4:12:23 PM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 22 times
Was thanked: 284 time(s) in 247 post(s)
Also, I don't get the "no script engine available" error with 3 script engines and the left click again releases the window/resets things.

There's some kind of race condition combined with the variable locking that seems to be the cause of this, which I will still look into regarding ways to mitigate/improve that logic flow.
Matija  
#25 Posted : Monday, June 21, 2021 5:13:42 PM(UTC)
Matija

Rank: Member

Reputation:

Groups: Approved
Joined: 6/11/2021(UTC)
Posts: 22
Croatia

Thanks: 6 times
I tried again with two other mice, one wired and one wireless. Repeated testing with each of them and managed to reproduce the problem with both. However, it took me longer to trigger the problem with the wireless one. I don't think it's a faulty click switch issue. I also tried with 3 script engines and managed to trigger it nevertheless.

Just to be clear: it's not happening very often, but when it does, it's that "oh, not again" moment. It creates a kind of anxiety because you never know when it will strike again. I hope you understand Smile
Matija  
#26 Posted : Tuesday, June 22, 2021 1:20:54 AM(UTC)
Matija

Rank: Member

Reputation:

Groups: Approved
Joined: 6/11/2021(UTC)
Posts: 22
Croatia

Thanks: 6 times
I don't know if this helps, but if I use an actual gesture (e.g. "Up" + Left btn hold) instead of the rocker gesture (Gesture btn + Left btn hold), I cannot recreate the issue anymore. It seems that only rocker gestures cause the problem in this type of scenario...
Rob  
#27 Posted : Tuesday, June 22, 2021 2:19:22 AM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 22 times
Was thanked: 284 time(s) in 247 post(s)
Interesting, that's helpful.

Do you have the rocker gesture support box checked in Options?
Matija  
#28 Posted : Tuesday, June 22, 2021 10:18:20 AM(UTC)
Matija

Rank: Member

Reputation:

Groups: Approved
Joined: 6/11/2021(UTC)
Posts: 22
Croatia

Thanks: 6 times
I did up until now - I've just disabled it. But seemingly it doesn't help. The issue persists.
Rob  
#29 Posted : Tuesday, June 22, 2021 4:48:41 PM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 22 times
Was thanked: 284 time(s) in 247 post(s)
Okay, I think I may have found a race condition in getting an available script engine.

In your logs, you can see that sometimes you'll get engine E0 for the drag window script, then also get E0 for the left click script (when it's not working properly).

Since E0 is currently executing the loop, executing another statement in the same script engine either gets queued behind the loop statement's execution or discarded (not sure which). Chrome V8 is single threaded for script execution.

Either way, it shouldn't be getting the same engine when it's already been reserved for execution. There's a locking process around getting an available engine, however that lock is released prior to the script executing (where the flag is set to say that engine is not available). So if it all happens fast enough, two script/action/click executions could both get the same script engine resulting in one of them not being able to run the script (or at least not concurrently).

I've made some updates to that workflow which should ensure the "is engine available" logic is airtight (hopefully!).

Try this out and let me know how it works:

https://www.strokesplus....s.net_Setup_0.4.2.7e.exe

Edited by user Tuesday, June 22, 2021 4:53:39 PM(UTC)  | Reason: Not specified

thanks 1 user thanked Rob for this useful post.
Matija on 6/22/2021(UTC)
Matija  
#30 Posted : Tuesday, June 22, 2021 11:39:10 PM(UTC)
Matija

Rank: Member

Reputation:

Groups: Approved
Joined: 6/11/2021(UTC)
Posts: 22
Croatia

Thanks: 6 times
I think you did it! I tried 200-300 times in a row and I couldn't get the error to reappear!
There's something else, too. I think I got your explanation, so I went looking what kind of mouse event could be triggering at about the same moment as the drag script. And that would be the Release event. Because prior to starting the Drag script, the gesture button must be released. Turn's out that I had the Release event enabled, because that was something I needed for my other Window Resize script to be able to break the loop when I press the middle button:

Code:
if(!click.Down && click.Button == MouseButtons.Middle) {
    sp.StoreBool("ResizeWindow", false);
}


Before I went to install and test v0.4.2.7e, I disabled the Release event on the buggy version and the issue wasn't happening anymore! So I guess that Release event was the other script getting into the race condition. I enabled it once more in the v0.4.2.7e and this time there are no problems. Well done, Rob! Smile ThumpUp

Edited by user Tuesday, June 22, 2021 11:40:12 PM(UTC)  | Reason: Not specified

Rob  
#31 Posted : Tuesday, June 22, 2021 11:47:14 PM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 22 times
Was thanked: 284 time(s) in 247 post(s)
Woohoo!
Matija  
#32 Posted : Wednesday, June 23, 2021 12:15:33 AM(UTC)
Matija

Rank: Member

Reputation:

Groups: Approved
Joined: 6/11/2021(UTC)
Posts: 22
Croatia

Thanks: 6 times
Ok, now using this last version, I get this error when I try to login to synchronize settings:

Code:
Could not load file or assembly 'Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)



Rob  
#33 Posted : Wednesday, June 23, 2021 1:14:17 AM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 22 times
Was thanked: 284 time(s) in 247 post(s)
Ack, try this:

https://www.strokesplus.net/files/StrokesPlus.net_Setup_0.4.3.1a.exe

I have a massive number of changes in the dev branch and master was a couple versions behind. I pulled 0.4.3.1 from dev and merged it into master, I think this should all be brought up to where it should be now.
Matija  
#34 Posted : Wednesday, June 23, 2021 10:54:01 AM(UTC)
Matija

Rank: Member

Reputation:

Groups: Approved
Joined: 6/11/2021(UTC)
Posts: 22
Croatia

Thanks: 6 times
It's working now. Thank you so much for solving this issue! I'm gonna buy you a lunch BigGrin
Rob  
#35 Posted : Wednesday, June 23, 2021 1:35:28 PM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 22 times
Was thanked: 284 time(s) in 247 post(s)
Thank you very much!

But also, thank you bringing this to my attention and helping me isolate the issue to resolve it.

I may not be the best at documentation and adding all of the bells and whistles of a refined, user friendly app - but I absolutely want it to always function exactly as it's supposed to.
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.