0

I'm trying to make a simple program that will monitor the chat window of an app and play a sound when a certain string appears. Firstly how would I go about finding the right element?

Using 'Inspect.exe', the only thing I can see that is unique about the chat box is this line under 'How found': hwnd=0x00000000003B1A1A 32bit class="PokerStarsChatClass" style=0x54000000 ex=0x0.

So I assume I need to search for this PokerStarsChatClass somehow. All tutorials I looked for couldn't really help me. Could anyone help?

edit: adding screenshots: (the name of the app is 'pokerstars') pokerstars
(source: imagefra.me)

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Jynn
  • 287
  • 1
  • 3
  • 18
  • Have you looked at this article? Sounds promising: http://www.codeproject.com/Articles/289028/White-An-UI-Automation-tool-for-windows-applicatio – Adolfo Perez May 18 '15 at 13:55
  • What is also (usually) unique is the element's tree in the tree pane (if you don't have a tree pane, it's because your inspect.exe is too old). If you have a real app sample, we can investigate further, because not all app are UI automatable – Simon Mourier May 18 '15 at 14:10
  • added a screenshot of the 'inspect.exe' results. – Jynn May 18 '15 at 14:44

1 Answers1

0

The UiPath Automation SDK offers some nice tools for grabbing text from arbitrary windows, but it is not free. It provides at least three different methods of scraping window text. It's possible that none of them will work for the particular application/window you're interested in.

Without using an automation SDK, you may be able to get the text relatively painlessly if the chat window will respond to a WM_GETTEXT message (and there's really no way to know except to test it). First, you would need to use a combination of GetWindow and GetClassName, both via platform invoke, to find the chat window's handle. After that you can send the WM_GETTEXT message directly.

RogerN
  • 3,761
  • 11
  • 18
  • thanks for your suggestions. I think it was a bit silly of me to even attempt this as I'm a novice programmer and wouldn't have a clue how to implement what you're suggesting. I may pay someone at odesk to make it for me rather. – Jynn May 18 '15 at 15:29