StrokePlus.net - Powerful Hotkey Boot
2021-01-20
Below Snippets are for
StrokePlus.net
StrokePlus.net
is the new version of StrokePlus
StrokePlus.net is using C# for scripts.
Google 'C# How to do xxx' to find the help.
Double press backquote(`) to trigger F2
200ms is the best suitable duration for double press
If only pressed for once, original key stroke will be triggered
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);
}
If you want to bind virtual key, you need to set the hotkey unregistered and consume:
sp.SendVKeyDown(vk.LCONTROL);
sp.SendVKeyDown(vk.LWIN);
sp.SendVKeyDown(vk.RIGHT);
sp.SendVKeyUp(vk.LCONTROL);
sp.SendVKeyUp(vk.LWIN);
sp.SendVKeyUp(vk.RIGHT);
sp.RunProgram('C:\\InstalledSoftware\\VoiceInput\\1.0.0.170\\VoiceInput.exe', '', 'open', 'normal', true, false, false);
Macros will be treated as plain string, 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/gesture:
// Usage (Double Press F1 to send Alt+F4):
eval(sp.GetMacroScript("Functions", "activeDoublePress"));
activeDoublePress(`sp.SendKeys("{F1}")`,`sp.SendModifiedVKeys([vk.LMENU], [vk.F4]); `);
留言板
正在加载 评论框