Get Text Issue

Started by Jeremy Whilde, May 28, 2014, 09:48:47 AM

Previous topic - Next topic

Jeremy Whilde

I am trying to get text from some error messages across a number of different applications so I have tried:

AddExtender("wwctl44i.dll")

titlewnd=DllHwnd("Warning~")
ctrlhwnd=cWndByID(titlewnd,65535)   ; this will change
;ctrlhwnd=cWndBySeq(titlewnd,3)   ; this will change
text=cGetEditText(ctrlhwnd)
Message("Message Text", text)

The issue I need to get around is; the text is contained in a control in an edit box and the control will have a different ID, sequence and or class across different applications displaying the error, so how do you manage getting the text without having to change the ID or class? The text in the control is also variable. Any ideas how to cope with this?

Thanks JW

Deana

I think I would use WinItemChild to get the child windows.

Code (winbatch) Select
data = WinItemChild(title)

Here is a test script you can use with your various Error messages to confirm that you can get the contents.:

Code (winbatch) Select
WindowOnTop('',1)
BoxTitle('Click to activate the window of interest')
While @TRUE
   If IsKeyDown( @SHIFT) then break
   title = WinGetACtive()
   data = WinItemChild(title)
   text = 'Hold SHIFT key to EXIT.':@CRLF :'Window Title: ':title:@CRLF:'Contents: ':data
   BoxText(text)   
   TimeDelay(0.5)
EndWhile
exit
Deana F.
Technical Support
Wilson WindowWare Inc.

Jeremy Whilde

The problem is we need to qualify on the message text and automatically close some of the messages, without user intervention so cannot use the suggested method.

Thanks JW

Deana

Please explain. Did you try the code I posted with each of the possible error messages? Do all of the error message contain the word 'Warning'. If so you code could look something like this:

Code (winbatch) Select
title = '~Warning'
BoxTItle('Looking for an error window ')
BoxText('Hold SHIFT key to EXIT.' )
While @TRUE
   If IsKeyDown( @SHIFT) then break
   If WinExist( title )
      data = WinItemChild(title)
      Pause('Window Title: ':title,data)
   Endif   
   TimeDelay(0.5)
EndWhile
exit


I would expect WinItemChild to get all of the error messages elements. You will need to find some element to "search for" that is available on all error messages.

You might also want to investigate cFindbyName. It gets the window handle of the first window whose window name matches the specified 'partial window name'.

Do you have screen shot of the various error messages?

Also have you produced Window Analysis of each error message?

Reference:
http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WIL~Extenders/Control~Manager+!Window~Analysis~Script!.txt
Deana F.
Technical Support
Wilson WindowWare Inc.

Jeremy Whilde

Deana

OK thank you, I now see what you were suggesting with WinItemChild it does bring back all of the text on the error messages and as my original code using cWndByID & cWndBySeq was is a while loop I can replace these with WinItemChild. Then pull out the required part of the text string to qualify if it is safe to automatically close some of the error messages.

Thanks JW