python操作应用程序_如何使用python脚本控制应用程序

1586010002-jmsa.png

I have a cygwin application which i have invoked using python script like:

os.system("path of the exe file")

How can i enter text in the cygwin( which has appeared )using the python script itself???

解决方案Are you running Python directly from Windows or from CygWin? In case you run Python from Windows you probably need to use COM to send text to the CygWin window. The win32com module can be used (included in the PythonWin distribution). Look at other posts here for more information.

I would suggest that you build Python on CygWin instead (or download Python built for CygWin) and then you can make any os.system call you want to instead of sending text to the CygWin window.

Best regards

/Fredrik

Can you do something like this?

Expand|Select|Wrap|Line Numbers

thanks for all ur valuable suggestions.

Whenever i use popen to invoke cygwin application or any other application(e.g a simple notepad) the application is not appearing on the screen

eg.

import os

fd = os.popen("C:\cygwin\cygwin.bat","w")

fd.write("telnet 101.29.34.132")

fd.close()

i am unable to view any changes this program makes

我有一个使用python脚本调用的cygwin应用程序,如:

os.system("exe文件的路径")

我如何输入cygwin中的文本(已经出现)使用python脚本本身???

解决方案

你是直接从Windows运行Python还是从CygWin运行?如果您从Windows运行Python,您可能需要使用COM将文本发送到CygWin窗口。可以使用win32com模块(包含在PythonWin发行版中)。在这里查看其他帖子以获取更多信息。

我建议您在CygWin上构建Python(或者下载为CygWin构建的Python)然后你可以让任何os.system调用你想要而不是发送文本到CygWin窗口。

最好的问候

/ Fredrik

你能做点什么吗?像这样?

展开 | 选择 | Wrap | 行号

感谢所有您宝贵的建议。

每当我使用popen时调用cygwin应用程序或任何其他应用程序(例如一个简单的记事本)应用程序没有出现在屏幕上

例如。

import os

>

fd = os.popen(" C:\ cygwin \cygwin.bat"," w")

fd.write(" telnet 101.29.34.132" )

fd.close()

i无法查看此程序所做的任何更改

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值