开发者

python to capture output of another windows - GUI program

开发者 https://www.devze.com 2023-03-02 01:01 出处:网络
The situation is like this: I want to capture the pop-ups of IPmsg.exe in my python program. There is an easy way of doing it, which is reading from the log file. But I would like to know if this can

The situation is like this: I want to capture the pop-ups of IPmsg.exe in my python program.

There is an easy way of doing it, which is reading from the log file. But I would like to know if this can be done without bringing log files into discussion. For more on IPmsg.exe: http://ipmsg.org/index.html.en

That was being specific. Now, what would be a generic approach to capturing the output of a windows based GUI p开发者_高级运维rogram?


There are generally two ways to talk to GUI programs on Windows, if you hate the log files:

  1. Use their command line interface! I doubt this has one that outputs to stdout as messages come in
  2. Use the win32 api or a wrapper for it to search for specific windows (polling as necessary or installing hooks to find out when they appear) and then grabbing text from them using more api calls. See this question: Get text from popup window

+1 for using the log files by the way, far easier.


You can capture only the output from applications through Python that you start directly from Python e.g. using the subprocess module:

http://docs.python.org/library/subprocess.html

Otherwise you have basically no chance for reading the direct output of other applications.

0

精彩评论

暂无评论...
验证码 换一张
取 消