You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var wnd = sp.ForegroundWindow();
//sp.MessageBox(wnd.ExecutableName, 'Title');
var blacklist = [
"explorer.exe",
"sihost.exe",
"startmenuexperiencehost.exe",
"shellexperiencehost.exe",
"searchhost.exe",
"searchui.exe",
"textinputhost.exe",
"ctfmon.exe",
"tabtip.exe"
]
var foundIndex = blacklist.indexOf(wnd.ExecutableName)
if (wnd != null && foundIndex==-1)
{
// climb to top-level window
// while (wnd.ParentSymmetric != null)
// wnd = wnd.ParentSymmetric;
// restore first so coords/sizing behave
if (wnd.Maximized)
wnd.Restore();
// find the LEFT-most monitor
var screens = System.Windows.Forms.Screen.AllScreens;
var leftMost = screens[0];
for (var i = 1; i < screens.Length; i++) {
if (screens[i].Bounds.Left < leftMost.Bounds.Left)
leftMost = screens[i];
}
// use WorkingArea (excludes taskbar)
var wa = leftMost.WorkingArea;
// keep current size
var pos = wnd.Position;
var w = pos.Right - pos.Left;
var h = pos.Bottom - pos.Top;
// move to top-left of left-most monitor working area
pos.Left = wa.Left;
pos.Top = wa.Top;
pos.Right = wa.Left + w;
pos.Bottom = wa.Top + h;
// If you instead want a “snap” style placement (ex: left half of that left-most monitor), swap the size part with:
pos.Left = wa.Left;
pos.Top = wa.Top;
pos.Right = wa.Left + wa.Width // (wa.Width / 2);
pos.Bottom = wa.Top + (wa.Height / 2); // wa.Height ;
wnd.Position = pos;
var info = new DisplayTextInfo();
// old text argument
//info.Title = "Maximize/Restore " + String(wnd.ExecutableName) + " Window";
info.Title = "Move " + String(wnd.ExecutableName) + " Window To Left";
info.TitleAlignment = "Center";
// old font + size
info.TitleFont = new Font("Helvetica", 25);
// old RGB (78,252,3)
info.ForeColor = "78,252,3";
// position: x=600, y=20
//info.Location = "600,20";
info.Location = "bottomleft"; // bottom-left of PRIMARY screen
// duration: 1300 ms
info.Duration = 1300;
// (optional but usually nice)
info.BackColor = "black";
info.Opacity = 0.7;
info.Padding = 15;
info.FadeSteps = 18;
info.UsePrimaryScreen = true;
sp.DisplayText(info);
}
MOVE TO RIGHT MONITOR / RIGHT HALF
var wnd = sp.ForegroundWindow();
// sp.MessageBox(foundIndex, 'Title');
var blacklist = [
"explorer.exe",
"sihost.exe",
"startmenuexperiencehost.exe",
"shellexperiencehost.exe",
"searchhost.exe",
"searchui.exe",
"textinputhost.exe",
"ctfmon.exe",
"tabtip.exe"
]
var foundIndex = blacklist.indexOf(wnd.ExecutableName)
if (wnd != null && foundIndex==-1)
{
// climb to top-level window
// while (wnd.ParentSymmetric != null)
// wnd = wnd.ParentSymmetric;
// restore first so coords/sizing behave
if (wnd.Maximized)
wnd.Restore();
var curScreen = wnd.Screen;
var curBounds = curScreen.Bounds;
var curWA = curScreen.WorkingArea;
var screens = System.Windows.Forms.Screen.AllScreens;
// Find the nearest screen to the RIGHT of the current one
var rightScreen = null;
var bestLeft = 2147483647; // big number
for (var i = 0; i < screens.Length; i++)
{
var b = screens[i].Bounds;
// "to the right" = its left edge is at/after current screen's right edge
if (b.Left >= curBounds.Right)
{
if (b.Left < bestLeft)
{
bestLeft = b.Left;
rightScreen = screens[i];
}
}
}
var pos = wnd.Position;
if (rightScreen != null)
{
// Move to TOP-LEFT of the right monitor's working area
var wa = rightScreen.WorkingArea;
// choose your snap sizing:
// example: full width, half height (like your earlier)
pos.Left = wa.Left;
pos.Top = wa.Top;
pos.Right = wa.Left + (wa.Width / 2);
pos.Bottom = wa.Top + (wa.Height / 2);
}
else
{
// No right monitor -> snap RIGHT HALF of CURRENT monitor (full height)
pos.Left = curWA.Left + (curWA.Width / 2);
pos.Top = curWA.Top;
pos.Right = curWA.Left + curWA.Width;
pos.Bottom = curWA.Top + curWA.Height;
}
wnd.Position = pos;
var info = new DisplayTextInfo();
// old text argument
info.Title = "Move " + String(wnd.ExecutableName) + " Window To Right";
info.TitleAlignment = "Center";
// old font + size
info.TitleFont = new Font("Helvetica", 25);
// old RGB (78,252,3)
info.ForeColor = "78,252,3";
// position: x=600, y=20
//info.Location = "600,20";
info.Location = "bottomleft"; // bottom-left of PRIMARY screen
// duration: 1300 ms
info.Duration = 1300;
// (optional but usually nice)
info.BackColor = "black";
info.Opacity = 0.7;
info.Padding = 15;
info.FadeSteps = 18;
info.UsePrimaryScreen = true;
sp.DisplayText(info);
}
TOGGLE MAXIMIZE/MINIMIZE
// Action script, maximize or minimize window where the gesture started
if(action.Window.Maximized) {
action.Window.Restore();
} else {
action.Window.Maximize();
}
var info = new DisplayTextInfo();
// old text argument
info.Title = "Toggle Maximize " + String(action.Window.ExecutableName) + " Window";
info.TitleAlignment = "Center";
// old font + size
info.TitleFont = new Font("Helvetica", 25);
// old RGB (78,252,3)
info.ForeColor = "78,252,3";
// position: x=600, y=20
//info.Location = "600,20";
info.Location = "bottomleft"; // bottom-left of PRIMARY screen
// duration: 1300 ms
info.Duration = 1300;
// (optional but usually nice)
info.BackColor = "black";
info.Opacity = 0.7;
info.Padding = 15;
info.FadeSteps = 18;
info.UsePrimaryScreen = true;
sp.DisplayText(info);
PASTE TEXT
sp.SendKeys("your text");
SEND KEYSTROKES
// Send the CTRL+C keystroke
sp.SendKeys("^c");
// Send the CTRL+V keystroke
sp.SendKeys("^v");
// Send ESC keystroke
sp.SendKeys("{ESC}");
// Send ENTER keystroke
sp.SendKeys("~");
// Send the CTRL+SHIFT+C keystroke
sp.SendKeys("^+c");
// Send the CTRL+W keystroke
// https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.sendkeys.send?view=windowsdesktop-10.0&redirectedfrom=MSDN#remarks
sp.SendKeys("^w");
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters