Charles,

As Jared mentioned, Immed is your friend. Put focus in the editor, pop up Immed, and do:

print FocusedWindow.ClassName

Using Visual Studio 2008, I get back:

VsTextEditPane

If I do:

print FocusedWindow.ModuleName, I get back:

MSENV

With that knowledge, I can then do:

Set codeWindows = ActiveWindow.Children.FilterByClassAndModule("VsTextEditPane, "MSENV")

If I then do:

print codeWindows.Count

I get back 9. I know that I'm only interested in one of those, so now it's time to narrow things down. I know I want the window that has the text in it, so I can look through each one, and see which window has an acceptable number of clips, by doing:

For Each wObj In codeWindows : print wObj.Clips.Count : Next

That gives me back:

0
0
0
0
0
0
0
0
51

Bingo. That window with 51 clips is most likely the one I want. So now I'll do:

For Each wObj In codeWindows : If wObj.Clips.Count > 0 Then : Set codeWindow = wObj : Edit For : End If : Next

To verify that codeWindow got set, I can do:

print TypeName(codeWindow)

Which gives me back:

Window

So now I have a Window object representing the window that contains all the text I'm interested in. So now it's time to iterate through the clips, and print out all the ones that are text. I have a header file currently loaded in the IDE, so I can get the text of the window by doing this:

For Each clip In codeWindow.Clips : If clip.Type = ctText Then : print clip : End If : Next

And I get back:

#ifndef
 _SWPMAIN_
#define
 _SWPMAIN_
#include

"swap.h"
// Declare Menu constants
#define
 LOGON     1
#define
 SELECT_RECIPIENT  2
#define
 ENTER_RECIPIENT   3
#define
 GET_DETAILS    4
#define
 SEND_NO_UI    5
#define
 SEND_UI     6
#define
 SEND_ATTACH    7
#define
 CREATE_MSG    8
#define
 LIST_INBOX    9
#define
 READ_MAIL    10
#define
 LOGOFF     11
#define
 EXIT        12
#define
 REFRESH     13
void
 main(
int
 argc,
char
 *argv[ ],
char
 *envp[ ] );
void
 PrintMenuToConsole (
void
 );
#endif

Viola! Note that you're only going to get the text that's visible on screen, since that's what clips are. So if I make my IDE window really small, then do the same thing above, I might only get:

#ifndef
 _SWPMAIN_
#define
 _SWPMAIN_
#include

"swap.h"
// Declare Menu constants
#define
 LOGON     1

But that's one way to get clips from a specific window. I hope that's helpful.

Aaron

Charles Steyn wrote:
Hi list and especially Aaron,

Last week I reported a possible regression to [EMAIL PROTECTED] The
contents of the search results list box in MSDN library is not spoken or
displayed in Braille with WE 7 Beta 2. This is not the on-line library,
but the disk-based library where Microsoft Document Explorer is the
actual running application. This worked fine in WE 6.1. The reason for me writing to this list about
it is that I can get the correct contents of the list box by getting the
text with the Immediate Window script:
Print FocusedWindow.Control.Text. As I move through the list box, the
corect information is retrieved in the immediate window. It should be possible to fix this bug with a script if it cannot be fixed internally before WE 7.0 is released. Again I cannot stress the value of scripting and especially the
Immediate Windows script enough. I can even get the text of certain
parts of Nokia PC Suite such as the opening screen and the About box by
using:
Print FocusedWindow.Accessible.Name

Thanks.
Charles Steyn


--
To insure that you receive proper support, please include all past
correspondence (where applicable), and any relevant information
pertinent to your situation when submitting a problem report to the GW
Micro Technical Support Team.

Aaron Smith
GW Micro
Phone: 260/489-3671
Fax: 260/489-2608
WWW: http://www.gwmicro.com
FTP: ftp://ftp.gwmicro.com
Technical Support & Web Development

Reply via email to