1、环境准备
- windows 7,8,10,11操作系统
- ahk 2.x_64位
2、使用方式
up/low 对字符串进行大小写转换,up 把所有字符转换为大写,low把所有字符转换为小写
- 输入win+R打开windows运行框
- 在运行框中输入:up hello World ,输出:“HELLO WORLD”
- 在运行框中输入:up HELLO WORLD ,输出:“hello world”
- 表达式按== 触发结果
3、演示
4、代码
#HotIf winActive("运行") and winActive("ahk_class #32770")
#MaxThreadsPerHotkey 10
;在运行框中执行强大的计算功能,包括数学运算等
:*?:==::{
try{
rawText:=ControlGetText("Edit1","A") ;
fullResult:=runbox.calculateExpression(rawText)
if fullResult{
ControlsetText(fullResult,"Edit1","A")
}
ControlSend("{END}","Edit1","A")
}
}
#HotIf
;==========================================================================================================系统快捷键映射
;执行各种运算取值
class runbox
{
;执行比表达式计算,"==" 触发,callflag是其他函数调用该方法
static calculateExpression(rawstr,callflag:=0)
{
;转换为大写
if inStr(rawStr,"up ")==1{
result:=strUpper(Trim(Ltrim(rawStr,"up")))
fulltxt:= rawStr . "=" result
return fulltxt
}
;转换为小写
if inStr(rawStr,"low ")==1{
result:=strLower(Trim(Ltrim(rawStr,"low")))
fulltxt:= rawStr . "=" result
return fulltxt
}
}
}
;==========================================================================================================系统快捷键映射
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ak工具类class
class ak
{
}
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ak工具类class
5、总结
这个代码功能比较简单,代码简洁
完整功能参考:windows超级运行框-表达式计算(12)汇总
各位大佬觉得还可以怎么操作? 欢迎评论区留言讨论!