我想在python中生成热字符串,在经过一些处理后将键入的一个单词转换为另一个单词,因为AHK在确定键入哪个单词时非常有限。现在,我正在ahk中使用一个hotstring,它在命令行上运行代码,该命令行使用我键入的单词作为参数运行python脚本。然后我使用pyautogui来输入单词。但是,这是非常缓慢的,在高速打字时不起作用。我正在寻找一种使用python和不使用ahk来完成这一切的方法,但我还没有找到一种在python中实现热字符串的方法。例如,每次我输入单词“test”时,它都会将其替换为“testing”。谢谢您的帮助。顺便说一下,我正在运行最新版本的Python和Windows 10,如果这对任何人都有用的话
(如果您希望在键入每个字母(t、te、tes、test)时对其进行处理,则应编辑您的问题)
我使用ahk热键调用我的SymPy函数。我将python脚本注册为COM服务器,并使用ahk加载它。
我没有注意到任何延迟。
您需要pywin32,但不要使用
pip install pywin32
下载 从https://github.com/mhammond/pywin32/releases下载
否则它将不适用于AutoHotkeyU64.exe,它将只适用于AutoHotkeyU32.exe。
确保下载amd64,(我下载了pywin32-300.win-amd64-py3.8.exe)
原因如下:how to register a 64bit python COM server
toUppercase COM server.py
首先需要注册python COM服务器:
首先,获取您自己的CLSID:只需使用python shell
然后,将
myClsid
设置为该输出要注册:
python "toUppercase COM server.py" register
要取消注册:
python "toUppercase COM server.py" unregister
hotstring python toUppercase.ahk
你可以测试hotstring
hello world
的速度,它对我来说非常快。根据您的喜好编辑
def toUppercase(string):
相关问题 更多 >
编程相关推荐