StrokePlus.net - Powerful Hotkey Boost
StrokePlus.net is the enhanced version of StrokePlus, offering more features and improved script support. The following examples demonstrate the capabilities of StrokePlus.net.
StrokePlus.net utilizes C# for scripting. For assistance, you can search online with queries like 'C# How to do xxx'.
This script allows users to trigger the F2 key by double-pressing the backquote (`) key within a 200ms interval. If only pressed once, the original key stroke will be registered.
var duration = 200;
var alreadyPressed = sp.GetStoredBool("pressed");
var originalKeyStroke = "`";
if (alreadyPressed) {
sp.DeleteAllTimers();
sp.StoreBool("pressed", false);
/* The actual events are triggered here */
sp.SendKeys("{F2}");
} else {
sp.CreateTimer(
"test",
duration,
-1,
String.raw`
/* after time out for 200ms, trigger the event here */
sp.SendString(originalKeyStroke);
sp.StoreBool("pressed", false);
`
);
sp.StoreBool("pressed", true);
}
To bind a virtual key, ensure that the hotkey is unregistered and consumed:

The following script allows you to switch to the next or previous screen using keyboard shortcuts:
sp.SendVKeyDown(vk.LCONTROL);
sp.SendVKeyDown(vk.LWIN);
sp.SendVKeyDown(vk.RIGHT);
sp.SendVKeyUp(vk.LCONTROL);
sp.SendVKeyUp(vk.LWIN);
sp.SendVKeyUp(vk.RIGHT);
To open a specific application, use the following script. Note the use of double backslashes in the file path:
sp.RunProgram('C:\\Path\\FolderA\\FolderB\\VoiceInput.exe', '', 'open', 'normal', true, false, false);
This script captures the current mouse position, performs a click, and then returns the mouse to its original location:
/*
var a = sp.GetCurrentMousePoint();
sp.MessageBox(a.X + ',' + a.Y,'getPosition')
*/
var a = sp.GetCurrentMousePoint();
sp.MouseClick(new Point(939, 245), MouseButtons.Left, true, false);
sp.Sleep(86);
sp.MouseClick(new Point(939, 245), MouseButtons.Left, false, true);
sp.MouseMove(new Point(a.X, a.Y));
This snippet generates a script to perform a quick click and saves it to the clipboard. You can create another hotkey with the copied script:
var currentMousePoint = sp.GetCurrentMousePoint();
sp.MessageBox(currentMousePoint.X + "," + currentMousePoint.Y, "getPosition");
var mousePoint = currentMousePoint.X + "," + currentMousePoint.Y;
var code = String.raw`var a = sp.GetCurrentMousePoint();
sp.MouseClick(new Point(${mousePoint}), MouseButtons.Left, true, false);
sp.Sleep(86);
sp.MouseClick(new Point(${mousePoint}), MouseButtons.Left, false, true);
sp.MouseMove(new Point(a.X, a.Y));`;
clip.SetText(code); // Code will be set to clipboard
sp.MessageBox(code, "Code Copied to Clipboard");
Macros are treated as plain strings, so use eval()
to trigger them:
function activeDoublePress(actualKey, functionKey) {
var duration = 200;
var alreadyPressed = sp.GetStoredBool("pressed");
if (alreadyPressed) {
sp.DeleteAllTimers();
sp.StoreBool("pressed", false);
sp.SendKeys(functionKey);
} else {
sp.DeleteAllTimers();
sp.CreateTimer(
"test",
duration,
-1,
String.raw`sp.SendString('${actualKey}');sp.StoreBool("pressed", false);`
);
sp.StoreBool("pressed", true);
}
}
For any hotkey or gesture, you can implement the following:
// Usage (Double Press F1 to send Alt+F4):
eval(sp.GetMacroScript("Functions", "activeDoublePress"));
activeDoublePress(`sp.SendKeys("{F1}")`,`sp.SendModifiedVKeys([vk.LMENU], [vk.F4]); `);
关于本文
文章标题 | StrokePlus.net - Powerful Hotkey Boost |
发布日期 | 2021-01-20 |
文章分类 | Tech |
相关标签 | #StrokePlus |