[jawsscripts] Re: Using the SetWindowVisualState Method

  • From: Marcus <marcus.canaday@xxxxxxxxx>
  • To: jawsscripts@xxxxxxxxxxxxx
  • Date: Sun, 5 Feb 2017 09:02:11 -0500

I'm still struggling with the SetWindowVisualState mmethod. I use  
scripts using the following function to quickly move from one program to 
another. Occasionally, the program I'm moving to is minimized and I 
can't interact with it. I haven't been able to set the visual state to 
"maximized" when the focus moves to a minimized window. Again, any help 
would be appreciated. Here's the function:


String Function MoveToProgram (string ByRef ProgramName)

var
Object MyObject = CreateObjectEx("FreedomSci.UIA", false, 
"UIAScriptAPI.x.manifest"),
Object MyTreeWalker = MyObject.ControlViewWalker (),
Object Pattern = MyTreeWalker.CurrentElement.GetWindowPattern,
Int Safety = 1

MyTreeWalker.CurrentElement = 
MyObject.GetElementFromHandle(GetAppMainWindow(GetCurrentWindow()))
MyTreeWalker.GoToRootElement

While Safety <=10
MyTreeWalker.GoToNextSibling
If StringContains (MyTreeWalker.CurrentElement.name, ProgramName)
SayString ("Moving to " + ProgramName)
myTreeWalker.CurrentElement.SetFocus
Pattern.SetWindowvisualState(WindowVisualState_Maximized)
Return
EndIf
Safety = Safety+1
EndWhile

EndFunction



On 2/4/2017 12:39 PM, Bob wrote:

I cant remember the line to declare the the UIA object so some lazy code 
below:

hWnd = GetAppMainWindow(GetCurrentWindow())

Element = UIA.GetElementFromHandle(hWnd)

Two options:

PatternObject = Element.GetWindowPattern()

PatternObject.SetWindowVisualState(WindowVisualState_Maximized)

Or single line:

Element. GetWindowPattern().SetWindowVisualState(WindowVisualState_Maximized)

Hope this helps

Bob


-----Original Message-----
From: jawsscripts-bounce@xxxxxxxxxxxxx 
[mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of Marcus
Sent: 04 February 2017 17:08
To: jawsscripts@xxxxxxxxxxxxx
Subject: [jawsscripts] Using the SetWindowVisualState Method
Importance: High

Good afternoon,


I'm hoping someone can give me an example of how to use the 
SetWindowVisualState method to maximize a window. Thanks much.



__________

View the list's information and change your settings at
//www.freelists.org/list/jawsscripts



__________�

View the list's information and change your settings at
//www.freelists.org/list/jawsscripts


__________�

View the list's information and change your settings at 
//www.freelists.org/list/jawsscripts

Other related posts: