Hi Charles, Forgiving my lack of familiarity with VS, couldn't you find out what Window the edit pane is with the Immed script? Since it retains knowledge of the active and focused windows before it gets focus, just put focus in the desired window and have Immed print some sort of identifying statement, such as the window name or classname. Additionally, if you haven't seen them yet, let me call your attention both to the Treeview script Aaron wrote as well as Jamal's Harvest Window script, both of which can be very useful when trying to figure out what windows are giving you what information.

Best,
Jared



Charles Steyn wrote:
Hi Aaron,

Thanks very much for your response. How do you get the clip information
from the window when you do not know which window to query? In the case
of the VS.Net IDE there are more than 130 child windows of the
ActiveWindow. Not 1 of these windows has the name or type VSEditPane.
This is the name of the editor window if you look at the Reclass dialog.

Regards
Charles Steyn

-----Original Message-----
From: Aaron Smith [mailto:[EMAIL PROTECTED] Sent: 13 August 2008 18:30
To: [email protected]
Subject: Re: Getting text from Visual Studio editor

Charles Steyn wrote:
Today I spent a few hours trying to modify my copy of the SelectText
script to work in Visual Studio. I used the Immed script to try and
get
text from the Visual Studio editor without any success.
Print focusedwindow.control.text yields nothing although this works in
other editors such as notepad.

That's because this isn't a standard control, so it doesn't support the standard control methods and properties (like .Text).

The NativeObjectModel property does not work at all for vS.

That's completely up to Microsoft. So far, the only windows we've found that support the NativeObjectModel are some Microsoft Office applications (Word, Excel, Powerpoint), and rich edit controls. There may be others, but that's about it.

After experimenting with the Children.FilterByName method I eventually
tried the following:
print ActiveWindow.Children.FilterByName("text
editor")(1).Control.Text
This only yields "text editor" the same as the window name and type.

That's really no different than doing the FocusedWindow.Control.Text method you tried. Since it's not a standard edit control, you won't be able to get text using the Control object of that window.

Is it possible to get and select text with the WE object model or
should
I rather look at the Visual Studio object model for this
functionality?

If the Studio OM already has that functionality, then it would be quicker to take advantage of it. That being said, you can get all of the

clips in that window, and determine which ones are selected. There are caveats to that, like when text scrolls off the screen and such, but with some work, it can be done.

Aaron


Reply via email to