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

Notification

Icon
Error

Options
Go to last post Go to first unread
soooulp  
#1 Posted : Wednesday, March 17, 2021 3:26:16 PM(UTC)
soooulp

Rank: Advanced Member

Reputation:

Groups: Moderators, Approved
Joined: 4/23/2020(UTC)
Posts: 161
China

Thanks: 46 times
Was thanked: 23 time(s) in 17 post(s)
It imitates WinXcorners that is open source in Github.

It will do some actions one time when the mouse moves to the corners and stay in there, if the mouse moves back and move to the same corner again, the action will recover.

I do a little modification base on Rob's script. Thanks, Rob.

https://forum.strokesplu...ouse-in-Corner-of-Screen

Put the following code in Global Actions-Load/Unload

Code:

sp.CreateTimer("CornerCheck", 0, 200, `
                                    var mousePos = sp.GetCurrentMousePoint();
                                    var mouseScreen = Screen.FromPoint(mousePos);
                                    if(mousePos.X == mouseScreen.Bounds.Right - 1 && mousePos.Y == mouseScreen.Bounds.Top) {
                                        //Action in upper right corner
                                        if(!sp.GetStoredBool("CornerCheckActive")) {
                                             sp.SendModifiedVKeys([vk.LMENU], [vk.F4]);
                                             sp.StoreBool("CornerCheckActive", true);
                                        } 
                                     } else if(mousePos.X == mouseScreen.Bounds.Right - 1 && mousePos.Y == mouseScreen.Bounds.Bottom - 1) {
                                        //Action in lower right corner
                                        if(!sp.GetStoredBool("CornerCheckActive")) {
                                             sp.SendModifiedVKeys([vk.LWIN], [vk.VK_D]);
                                             sp.StoreBool("CornerCheckActive", true);
                                        } 
                                     } else if(mousePos.X == mouseScreen.Bounds.Left && mousePos.Y == mouseScreen.Bounds.Top) {
                                        //Action in upper left corner
                                        if(!sp.GetStoredBool("CornerCheckActive")) {
                                             //Put your code here
                                             sp.StoreBool("CornerCheckActive", true);
                                        } 
                                     } else if(mousePos.X == mouseScreen.Bounds.Left && mousePos.Y == mouseScreen.Bounds.Bottom - 1) {
                                        //Action in lower left corner
                                        if(!sp.GetStoredBool("CornerCheckActive")) {
                                             sp.SendVKey(vk.LWIN);
                                             sp.StoreBool("CornerCheckActive", true);
                                        } 
                                     } else {
                                        sp.StoreBool("CornerCheckActive", false);
                                     }`
);


There are some actions for reference:

Monitors Off
sp.WindowFromHandle(new IntPtr(0xffff)).PostMessageObj(0x112, 0xf170, 2);

All Windows
sp.SendModifiedVKeys([vk.LWIN], [vk.TAB]);

Hide Other Windows
sp.SendModifiedVKeys([vk.LWIN], [vk.HOME]);

A tip on Win10:
Setting-System-Multitasking-Snap windows

If you choose on, other windows will hide when you snap a foreground window, as well as hotkey Win+Home.


thanks 3 users thanked soooulp for this useful post.
Rob on 3/17/2021(UTC), misaki4650 on 3/17/2021(UTC), randomConstant on 2/9/2022(UTC)
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.