有没有办法将一些参数从 autohotkey 发送到 python。
我使用 Autohot 键从记事本中读取了一些数字并存储在一个变量中,现在我想将这个数字发送到 python 代码以便进行一些计算。
我的 Autohotkey 代码是:
controlGetText, telphoneNumber, Edit1, Untitled - Notepad
我想将这个 telphoneNumber
发送到 python 文件。
有什么办法可以做到吗?
我需要创建一个 python 的 exe 文件,然后从 autohotkey 调用吗? 例如:
RunWait, C:\Button\button.exe telphoneNumber
或者我需要从 autohotkey 运行命令提示符命令来运行 python 程序吗?像这样的东西:
Run Cmd Python C:\Button\button.py telphoneNumber
我不知道哪个是最好的方法,因为我是 Autohotkey 的新手。
任何建议将不胜感激。
编辑:
但是我通过使用 autohotkey 的运行命令成功发送了参数,这将从命令提示符执行 python 文件。
Run Cmd \k "Python C:\Button\button.py %telphoneNumber%"
但仍然想知道这是否是正确的解决方案,或者是否还有其他解决方案?
最佳答案
进程间通信能够在 Python 脚本运行时发送信息。
论坛主题:http://www.autohotkey.com/forum/topic21699.html (该帖子中有一个很好的文档链接)
您也可以使用 TCP/IP 网络通信(如下文所示),但这可能不如使用 IPC 灵活。
关于python - Autohotkey 和 python 之间的通信,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6135238/