先打开计算器,依次点击 1,6,平方根 按钮,其实就是求16的平方根。
Run calc
Sleep,1000
op:=["1","6","平方根"]
for key,val in op
InvokeUiaButtonClick(GetUiaButton(val))
return
GetUiaButton(_in)
{
;这里需要配置
keymap:={"1":"Button5","2":"Button11","3":"Button16","4":"Button4","5":"Button10","6":"Button15","7":"Button3","8":"Button9","9":"Button14","0":"Button6",".":"Button17","平方根":"Button25","+":"Button23","-":"Button22","*":"Button21","/":"Button20","=":"Button28","C":"Button13"}
for key,value in keymap
{
if (key=_in)
return %value%
}
}
InvokeUiaButtonClick(_in)
{
ControlClick,%_in%,ahk_class CalcFrame
}
先手动打开计算器calc.exe,然后运行上面的代码,计算器会停留在该界面: