Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,359 Location: Tampa, FL Thanks: 28 times Was thanked: 419 time(s) in 356 post(s)
|
This script is a timer that polls every 200 milliseconds to check the mouse's location and if it's in the lower right corner of the screen where the mouse resides, shows a message box: Code:sp.CreateTimer("CornerCheck", 0, 200, `if(!sp.GetStoredBool("CornerCheckActive")) {
sp.StoreBool("CornerCheckActive", true);
var mousePos = sp.GetCurrentMousePoint();
var mouseScreen = Screen.FromPoint(mousePos);
if(mousePos.X == mouseScreen.Bounds.Right - 1 && mousePos.Y == mouseScreen.Bounds.Bottom - 1) {
//Put your code here
sp.MessageBox("In lower right corner!", "Hi");
}
sp.StoreBool("CornerCheckActive", false);
}`);
Note that for the Right and Bottom screen properties, you need to subtract 1 pixel since the mouse cursor cannot reside along those edges. This script is the same, but for the upper left corner: Code:sp.CreateTimer("CornerCheck", 0, 200, `if(!sp.GetStoredBool("CornerCheckActive")) {
sp.StoreBool("CornerCheckActive", true);
var mousePos = sp.GetCurrentMousePoint();
var mouseScreen = Screen.FromPoint(mousePos);
if(mousePos.X == mouseScreen.Bounds.Left && mousePos.Y == mouseScreen.Bounds.Top) {
//Put your code here
sp.MessageBox("In upper left corner!", "Hi");
}
sp.StoreBool("CornerCheckActive", false);
}`);
The CornerCheckActive bool is just to prevent multiple/continued execution when the mouse is in the location, until the script finishes that is. You could also store the current location and if hasn't left the corner, to not execute again until the mousePos has changed then came back to the corner, for example. You could either start this script manually via an action, or add it to your Global Actions > Load/Unload Scripts > Load Script so it starts when S+.net starts. Edited by user Friday, July 19, 2019 12:06:42 PM(UTC)
| Reason: Not specified
|
|
|
|
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