惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

大猫的无限游戏
大猫的无限游戏
J
Java Code Geeks
小众软件
小众软件
D
Docker
腾讯CDC
H
Hackread – Cybersecurity News, Data Breaches, AI and More
V
V2EX
博客园 - 叶小钗
GbyAI
GbyAI
Microsoft Azure Blog
Microsoft Azure Blog
Stack Overflow Blog
Stack Overflow Blog
B
Blog RSS Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 【当耐特】
IT之家
IT之家
博客园 - 司徒正美
M
MIT News - Artificial intelligence
T
The Blog of Author Tim Ferriss
The GitHub Blog
The GitHub Blog
罗磊的独立博客
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
L
LangChain Blog
阮一峰的网络日志
阮一峰的网络日志
C
Check Point Blog

szhshp 的第三边境研究所

假设, AI 把我代替的那一刻真的到来 | szhshp 的第三边境研究所 小傻瓜都能懂的 AstrBot QQ 机器人集成 MCP 功能实战指南 | szhshp 的第三边境研究所 《智人之上: 从石器时代到 AI 时代的信息网络简史》阅读笔记 | szhshp 的第三边境研究所 iPadOS 26 无法设置空间场景图片壁纸的解决方法 | szhshp 的第三边境研究所 《一路云海》(终) | szhshp 的第三边境研究所 《一路云海》(四): 如何不按套路旅行 | szhshp 的第三边境研究所 《一路云海》(三): In Ya Mellow Tone | szhshp 的第三边境研究所 《一路云海》(二): 关西世博参观纪实 | szhshp 的第三边境研究所 《一路云海》(一): 新的征程 | szhshp 的第三边境研究所 2025 大阪世博会 [ 3 天前-先到先得 ] 阶段 场馆预约必中独家攻略 | szhshp 的第三边境研究所 Hackathon 随想 | szhshp 的第三边境研究所 一杯双皮奶 | szhshp 的第三边境研究所 Armbian + CasaOS + NAS 配置指南 | szhshp 的第三边境研究所 Docker 构建镜像报错: error getting credentials - err: exit status 1, out: `` | szhshp 的第三边境研究所 Disqus RIP! 论过高的维护成本如何治疗固执的坏习惯 | szhshp 的第三边境研究所 炸弹猫桌游变体规则 | szhshp 的第三边境研究所 《小岛经济学》阅读笔记 | szhshp 的第三边境研究所 《金钱心理学》阅读笔记 | szhshp 的第三边境研究所 为知笔记 RIP: 迁移剩余的笔记 | szhshp 的第三边境研究所 2025 博客第十年展望 - 再见我的过去 | szhshp 的第三边境研究所 我在独立游戏里面致敬的作品 | szhshp 的第三边境研究所 《How to make thing faster》阅读笔记 | szhshp 的第三边境研究所 《The Art of Clean Code》阅读笔记 | szhshp 的第三边境研究所 《Clean Architecture: A Craftsman Guide to Software Structure and Design》阅读笔记 | szhshp 的第三边境研究所 《How AI Works》阅读笔记 | szhshp 的第三边境研究所 游戏策划废案 - Project Uranus | szhshp 的第三边境研究所 游戏策划废案 - Project X | szhshp 的第三边境研究所 人生第一款独立游戏开发复盘 | szhshp 的第三边境研究所 Trap of Life | szhshp 的第三边境研究所 如果我用手搓了个暗物质雏形 | szhshp 的第三边境研究所
StrokePlus.net - Powerful Hotkey Boost | szhshp 的第三边...
2021-01-20 · via szhshp 的第三边境研究所

Meta

目录

StrokePlus.net: Evolution from StrokePlus

StrokePlus.net is the enhanced version of StrokePlus, offering more features and improved script support. The following examples demonstrate the capabilities of StrokePlus.net.

Code Help

StrokePlus.net utilizes C# for scripting. For assistance, you can search online with queries like ‘C# How to do xxx’.

Usage

Activating a Hotkey with Double Press

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

Binding a Virtual Key

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

Opening a Specific Application

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

Clicking and Returning to the Previous Position

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

Generating a Quick Click Script

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

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

Usage Example

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]); `);