Hey Tom,

Would you have any code examples you could post showing how you work with a
control which is not a standard control type?  I'd like to see what that's
like.

Thanks.

Chip



-----Original Message-----
From: Tom Kingston [mailto:[email protected]] 
Sent: Monday, August 15, 2011 7:42 PM
To: [email protected]
Subject: Re: Reading Status Bar in Notepad and Word 2007

Hey Bruce,

Sorry. I should have said I knew it wouldn't work in Word instead of 
just giving the example of Notepad. It would be too much to expect 
Microsoft to use their own standards. But that's a given.

And just to clarify, wtStatus is not a window name. It's an enumeration 
defined within the Window-Eyes object model. In the app developers guide 
you'll find it under enumerations, WindowType. All the standard window 
types are defined this way; wtDialog, wtButton, wtCheckbox, wtEdit, etc. 
But they only apply to standard controls. So I just usually use this 
method first via the immediate mode app because it's quick and easy. If 
it fails, then I go on the hunt for the non-standard controls and how to 
reliably pick them out of the crowd.

Hth,
Tom


On 8/15/2011 1:26 PM, BT wrote:
>
> Hi Again Tom,
>
>      It came up with a count of 0. I suspected this when Chip said
something
> was not normal. Also, the list of 31 names did not come up with
wtStatus...
>      What I posted works for some windows so will see what happens in the
> future.
>          Bruce
>
> Sent: Monday, August 15, 2011 1:02 AM
> Subject: Re: Reading Status Bar in Notepad and Word 2007
>
>
> Here's a little more direct method to get a status bar when it's a
> standard status bar window, as in Notepad. Note, in some programs it
> will be a direct child and others it won't. So use DirectChildren or
> Children as needed. You can find out quickly in the immediate mode
> window. Although, if it is a direct child it will still be considered a
> child as well. So check the direct children first. There are usually
> many more children. So using DirectChildren will have to check fewer
> window objects.
>
> Set oStatusWindows = ActiveWindow.DirectChildren.FilterByType(wtStatus)
>
> This will return a collection which may be more than one if it's an MDI
> window.
>
> Hth,
> Tom
>
>
> On 8/14/2011 11:21 PM, BT wrote:
>>
>> To All,
>>
>>       There is more than one status bar in Word 2007 and the name is
>> different
>> than what is in Notepad so this is what I did to get it to speak the
>> status
>> bar in my Page_Num app to get the line and column number in Notepad and
>> now
>> at least the Page and word count in Word 2007.
>>
>> you have more than one status bar in Woord 2007 so do a loop and speak
it.
>> This is one of 2 methods to get the item number for the object in 2007
for
>> it will not return an object until you know it's location.
>>
>> App Segment:
>>    dim objMainWindow, objStatusBarWindow, objResults
>>    set objMainWindow = activeWindow.overlap
>> 'First Notepad:
>>    set objResults = objMainWindow.children.filterByName(
>> "msctls_statusbar32")
>>    if not objResults is nothing then
>>     if objResults.count>   0 then
>>      ' Window Found!
>>      set objStatusBarWindow = objResults(1) ' where 1 is the location for
>> the
>> Status Bar object.
>>      SpeakStatusBar objStatusBarWindow
>>      Exit Sub
>>     end if
>>    end if
>> ' Word 2007:
>>     set objResults = objMainWindow.children.filterByName( "status bar")
>>     if not objResults is nothing then
>>       ' Go through the collection of status bar objects.
>>      For Each objStatusBarWindow in objResults
>>       SpeakStatusBar objStatusBarWindow
>>       Exit Sub
>>      Next
>>     End If
>> End Sub
>>
>> Sub SpeakStatusBar( oStatusbar)
>>      ' now speak contents of the object clips.
>> ' First convert any text for easier reading.
>>      Dim txt: txt = oStatusbar.clips.clipstext
>>      txt = Replace( txt, "Ln", " Line ")
>>      txt = Replace( txt, "Col", " column ")
>>      txt = Replace( txt, ",", " ")
>>      Speak txt
>> End Sub
>>
>>
>
>

Reply via email to