|
|
发表于 2026-1-29 14:01:59
|
显示全部楼层
**
下载安装 AutoHotkey
新建一个.ahk脚本文件
#Persistent
#SingleInstance Force
; 目标软件:PowerMill(窗口标题包含"PowerMill")
TargetTitle := "PowerMill"
; 定时检测PowerMill窗口
SetTimer, CheckWindow, 1000
return
CheckWindow:
IfWinExist, %TargetTitle%
{
; 创建辅助按钮的GUI
Gui +LastFound +AlwaysOnTop -Caption +ToolWindow
Gui Color, FFFFFF
; 按钮位置:可根据PowerMill工具栏坐标调整(示例:x=800, y=30)
Gui Add, Button, x800 y30 w50 h25 gOpenCalculator, 计算器
Gui Show, x0 y0 NoActivate, PowerMill_CustomBtn
SetTimer, CheckWindow, Off ; 找到窗口后停止检测
}
return
; 按钮点击事件:启动系统计算器
OpenCalculator:
Run, calc.exe
return
; 关闭GUI时退出脚本
GuiClose:
ExitApp
保存脚本后,右键选择「Run Script」运行,打开 PowerMill 后,就会在你设定的位置(示例:x=800, y=30)出现一个 “计算器” 按钮,点击直接启动系统计算器; |
|