Skip to content

Instantly share code, notes, and snippets.

@Kambaa
Last active January 28, 2026 06:28
Show Gist options
  • Select an option

  • Save Kambaa/7317871716163764d27c59005c877ad5 to your computer and use it in GitHub Desktop.

Select an option

Save Kambaa/7317871716163764d27c59005c877ad5 to your computer and use it in GitHub Desktop.
My StrokesPlus:NET and StrokesPlus Settings

Move Window To Left Monitor:

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");

RUN COMMANDS

sp.Run('C:\\Program Files\\Sublime Text\\sublime_text.exe');

My Strokes Plus Settings:

I have been using Strokes Plus for years, and i tried and not liked the new one, so i've studied and configured old Strokes Plus to my liking.

In these files, you'll see my most used configurations.

Here's my screenshot of these codes used in the old StrokesPlus:

resim
acSendKeys("mypassword")
process_name=acGetExecutableName(acGetForegroundWindow())
local ignoredSet = {
["TurboLaunch.exe"] = true,
["explorer.exe"] = true,
["StrokesPlus.exe"] = true,
["SomeOtherProcess.exe"] = true
}
if not ignoredSet[tostring(process_name)] then
-- acMessageBox(tostring(process_name), nil)
acMaximizeOrRestoreWindow(acGetForegroundWindow(), nil, nil)
acDisplayText("Maximize/Restore "..tostring(process_name).. " Window","Helvetica",35,78, 252, 3,600,20,1300)
end
process_name=acGetExecutableName(acGetForegroundWindow())
if process_name ~= "TurboLaunch.exe" then
current_window=acGetForegroundWindow()
current_window_x=acGetWindowLeft(acGetForegroundWindow(), gsx, gsy)
current_window_y=acGetWindowTop(acGetForegroundWindow(), gsx, gsy)
-- acMessageBox("X: "..tostring(current_window_x).." Y: ".. tostring(current_window_y), "Current Window X Y Coords Is:", nil)
monitor_on_current_window=acGetMonitorFromPoint(current_window_x, current_window_y)
monitor_name=acGetMonitorName(monitor_on_current_window)
-- acMessageBox(monitor_name, "Current Monitor Name Is:", nil)
-- according to the description in acSendWindowToMonitorByName we need to escape the \ chars
left_monitor_name="\\\\.\\DISPLAY2"
right_monitor_name="\\\\.\\DISPLAY1"
monitor_name_to_send = left_monitor_name
monitor_handle_to_send=acGetMonitorFromName(monitor_name_to_send)
acDisplayText("Sending "..tostring(process_name).." Window To:\n"..tostring(monitor_name_to_send),"Helvetica",35,78, 252, 3,2000,20,1300)
if monitor_name ~= left_monitor_name then
acSendWindowToMonitorByName(current_window, nil, nil, monitor_name_to_send)
end
monitor_left=acGetMonitorLeft(monitor_handle_to_send, 1)
monitor_top=acGetMonitorTop(monitor_handle_to_send, 1)
monitor_right=acGetMonitorRight(monitor_handle_to_send, 1)
monitor_bottom=acGetMonitorBottom(monitor_handle_to_send, 1)
-- acMessageBox("Left:"..tostring(monitor_left).." Top:"..tostring(monitor_top).." Right:"..tostring(monitor_right).." Bottom:"..tostring(monitor_bottom), "Monitor Area Coords", nil)
current_window_size_x=math.abs(acGetWindowLeft(acGetForegroundWindow(), nil, nil) - acGetWindowRight(acGetForegroundWindow(), nil, nil))
current_window_size_y=math.abs(acGetWindowBottom(acGetForegroundWindow(), nil, nil) - acGetWindowTop(acGetForegroundWindow(), nil, nil))
monitor_size_x = math.abs(monitor_left-monitor_right)
monitor_size_y = math.abs(monitor_top-monitor_bottom)
local positions = {
["rustdesk.exe"] = 1920 - 690 - 850,
["ApplicationFrameHost.exe"] = monitor_top,
["Teams.exe"] = 1920 - 690 - 350 - 600,
["msedge.exe"] = 1920 - 690 - 350- 60 ,
["thunderbird.exe"] = 1920 - 690 - 350 - 650
}
local heights = {
["ApplicationFrameHost.exe"] = 600
}
local y_pos = positions[process_name] or (1920 - 690 - 350 - 850)
local height=heights[process_name] or 600
acRestoreWindow(acGetForegroundWindow(), nil, nil)
-- move window to the top of the monitor
acMoveWindow(acGetForegroundWindow(), nil, nil, monitor_left, y_pos)
-- set the window size with regarding to monitor size
acSetWindowSize(acGetForegroundWindow(), nil, nil, monitor_size_x, height)
end
process_name=acGetExecutableName(acGetForegroundWindow())
if process_name ~= "TurboLaunch.exe" then
current_window=acGetForegroundWindow()
current_window_x=acGetWindowLeft(acGetForegroundWindow(), gsx, gsy)
current_window_y=acGetWindowTop(acGetForegroundWindow(), gsx, gsy)
monitor_on_current_window=acGetMonitorFromPoint(current_window_x, current_window_y)
monitor_name=acGetMonitorName(monitor_on_current_window)
-- acMessageBox(monitor_name, "Current Monitor Name Is:", nil)
-- according to the description in acSendWindowToMonitorByName we need to escape the \ chars
left_monitor_name="\\\\.\\DISPLAY2"
right_monitor_name="\\\\.\\DISPLAY1"
monitor_name_to_send = right_monitor_name
acDisplayText("Sending "..tostring(process_name).." Window To:\n"..tostring(monitor_name_to_send),"Helvetica",35,78, 252, 3,2000,20,1300)
if monitor_name ~= right_monitor_name then
acSendWindowToMonitorByName(current_window, nil, nil, monitor_name_to_send)
end
acMaximizeOrRestoreWindow(acGetForegroundWindow(), nil, nil)
end
acSendKeys("^j")
acSendKeys("^v")
acSendKeys("^w")
acSendKeys("~")
acSendKeys("{ESC}")
acSendKeys("{LBRACE}")
acSendKeys("{SNAPSHOT}")
acSendKeys("^c")
acSetWindowSize(acGetForegroundWindow(), gsx, gsy, 1920, 1080)
acRunProgram("C:\\Program Files\\Sublime Text\\sublime_text.exe","",0, 1)

Comments are disabled for this gist.