Autohotkey 和 python 之间的通信 [英] Communicating between Autohotkey and python

查看:46
本文介绍了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.

有没有办法做到这一点?

Is there a way I can do that?

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

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

RunWait,  C:Buttonutton.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:Buttonutton.py telphoneNumber

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

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

任何建议将不胜感激.

但是,我通过使用 autohotkey 的运行命令成功发送了参数,该命令将从命令提示符执行 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:Buttonutton.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天全站免登陆