0

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 program?

Neeraj
  • 201
  • 3
  • 13
  • I assumed it was a Windows GUI app based on a brief look at the page, but I see in your question you say standard output. Can you confirm what kind of output you are talking about, and show it here? – Henry May 03 '11 at 05:22
  • @Henry: You are right. I edited my question. – Neeraj May 03 '11 at 05:26
  • 1
    @Neeraj Then #2 in my answer is the way to go really, and the linked question should get you pretty far along. Remember to download a program like Spy++ to help you find out what you're aiming/programming for. – Henry May 03 '11 at 05:28
  • @Henry: **Great.** . Thank you very much. I did not know anything about Spy++. – Neeraj May 03 '11 at 05:36

2 Answers2

1

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.

Community
  • 1
  • 1
Henry
  • 6,502
  • 2
  • 24
  • 30
1

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.