在Autohotkey和python之间进行通信 [英] Communicating between Autohotkey and python

查看:526
本文介绍了在Autohotkey和python之间进行通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以将一些参数从autohotkey发送到python.

Is there a way to send some parameter from autohotkey to python.

使用Autohot键,我从记事本中读取了一些数字并将其存储在变量中,现在我想将此数字发送到python代码以进行一些计算.

Using Autohot key I read some number from the notepad and store in a variable and now I want to send this number to the python code in order to do some calculations.

我的自动热键代码为:

controlGetText, telphoneNumber, Edit1, Untitled - Notepad

我想将此telphoneNumber发送到python文件.

And I want to send this telphoneNumber to python file.

有办法吗?

我需要创建一个python的exe文件,然后从autohotkey调用吗? 例如:

Do I need to create an exe file of a python and then call from autohotkey? For example:

RunWait,  C:\Button\button.exe telphoneNumber

还是我需要从autohotkey运行命令提示符命令来运行python程序?像这样:

Or do I need to run command prompt commands from autohotkey to run python program? Something like:

Run Cmd Python  C:\Button\button.py telphoneNumber

我不知道哪种方法是最好的方法,因为我是Autohotkey的新手.

I do not know which is the best way as I am newbie in Autohotkey.

任何建议将不胜感激.

但是我使用autohotkey的run命令成功发送了参数,它将在命令提示符下执行python文件.

However I succeded in sending parameter by using run command from autohotkey, which will execute the python file from command prompt.

Run Cmd \k "Python  C:\Button\button.py %telphoneNumber%"

但是仍然想知道这是否是正确的解决方案,或者是否还有其他解决方案?

But still want to know if this is the right solution, or if there are others?

推荐答案

完成工作的方法是最简单,而且可能是最好的完成目标的方法.

The way you got it working is the easiest, and probably best, method of accomplishing what you want.

应用程序之间的通信可以使用您可能想像的更多方法来完成,但是只要不是实时的,就可以使用参数调用程序,因为它既简单又可靠.

Communication between applications can be done with more methods then you probably can imagine, but as long as it doesn't have to be realtime you can call your programs with arguments, as it is easy and reliable.

这篇关于在Autohotkey和python之间进行通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆