viewpoint-particle

Author Topic: Get Text Issue  (Read 3934 times)

Jeremy Whilde

  • Jr. Member
  • **
  • Posts: 54
Get Text Issue
« on: May 28, 2014, 09:48:47 am »
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

  • Wilson WindowWare Tech Support
  • Pundit
  • *****
  • Posts: 1183
  • WinBatch® can do it.
    • WinBatch Tech Support Database
Re: Get Text Issue
« Reply #1 on: May 28, 2014, 11:35:19 am »
I think I would use WinItemChild to get the child windows.

Code: Winbatch
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
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

  • Jr. Member
  • **
  • Posts: 54
Re: Get Text Issue
« Reply #2 on: May 28, 2014, 02:34:23 pm »
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

  • Wilson WindowWare Tech Support
  • Pundit
  • *****
  • Posts: 1183
  • WinBatch® can do it.
    • WinBatch Tech Support Database
Re: Get Text Issue
« Reply #3 on: May 28, 2014, 02:48:55 pm »
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
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

  • Jr. Member
  • **
  • Posts: 54
Re: Get Text Issue
« Reply #4 on: May 29, 2014, 07:01:31 am »
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