[jawsscripts] Re: Searching menu structures for a particular menu item

  • From: "Bryan Garaventa" <bgaraventa11@xxxxxxxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>
  • Date: Tue, 23 Dec 2008 13:27:49 -0800

This is copied from one of my prior scripts.

SpeechOff ()

var object o, int cid,

string stv, handle gw

{alt+o}

Pause ()

let o = GetObjectAtPoint (cid, GetCursorCol (), GetCursorRow ())

o.accDoDefaultAction(6)

Pause ()

; ... script continues with SpeachOn(), etc.


The only way I was able to make this work, was by first manually activating 
the menu, so Doug is right, I believe it does have to be visible first.


----- Original Message ----- 
From: "Doug Lee" <doug.lee@xxxxxxxxxxxxxxxx>
To: <jawsscripts@xxxxxxxxxxxxx>
Sent: Tuesday, December 23, 2008 1:05 PM
Subject: [jawsscripts] Re: Searching menu structures for a particular menu 
item


> Come to think of it, this probably won't really help much after all.
> You can find menus and menu items in MSAA, but I don't think you can
> activate a menu option without first making it visible on screen.  I
> believe the menuItem codes mentioned earlier in this thread, locatable
> with WinDig, would allow you to execute menu items.  The JAWS
> SendMessage function should let you do that without AutoIt though.
>
> As far as sample code, there was some in the Skype scripts, probably in
> SkypeUtil.jsl; but I don't think it's there anymore.  I don't have to
> do this very often.
>
> On Tue, Dec 23, 2008 at 03:58:27PM -0500, Andy Borka wrote:
> Hi. Do you have any example code that searches for particular menu items?
> How do you deal with the top level menus in the menu bar (telling what one
> is what)?
>
>
> Twitter: www.twitter.com/sonfire
>
>
> -----Original Message-----
> From: jawsscripts-bounce@xxxxxxxxxxxxx
> [mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of Doug Lee
> Sent: Tuesday, December 23, 2008 2:50 PM
> To: jawsscripts@xxxxxxxxxxxxx
> Subject: [jawsscripts] Re: Searching menu structures for a particular menu
> item
>
> It's a bit more involved than I can recall or fully describe here, but
> here are the main ingredients I remember:
>
> 1.  Get the menubar object with
> GetObjectFromEvent(getTopLevelWindow(getFocus()), ObjID_Menu, 0, childID).
> ChildID is a placeholder.
>
> 2.  The menubar's items will be indexable by childIDs starting at 1,
> so for "File View Window Help," "Window" should be o.accName(3).  To
> get its object, do o.accChild(3).  You can of course search through
> these with a loop that runs from 1 through o.accChildCount inclusive.
>
> 3.  A menubar item has one child in MSAA:  The pop-up menu associated with
> it.
> To get that, do .accChild(1) on what you got in the previous step.
>
> 4.  The menu you now have has menu items much like the menubar did,
> each with its own pop-up menu where applicable.  Start again at step 2
> to search deeper.
>
> Tip:  JAWS now has functions that search MSAA object trees for names.
> If this works for menu hierarchies, and depending on your needs once
> you find something, that may significantly decrease the level of
> effort required for your situation.
>
> On Tue, Dec 23, 2008 at 02:37:38PM -0500, Jamal Mazrui wrote:
> There is not a way to do this natively through JAWS, except possibly by
> searching the MSAA hierarchy associated with a menu.  I don't know how
> to do that, but Doug Lee might ....
>
> If you are willing to install a free COM server, AutoIt,
> http://AutoItScript.com
>
> includes the method documented below.  Another approach is to get the ID
> of the menu item of interest via WinDig
> http://EmpowermentZone.com/wdsetup.exe
> and invoke it with a PostMessage call.
>
> Jamal
>
>
> WinMenuSelectItem
>
>
> Invokes a menu item of a window.
>
> WinMenuSelectItem "title", "text", "item" [, "item" [, "item" [, "item"
> [,
> "item" [, "item" [, "item"]]]]]]
>
>
> Parameters
> titleThe title of the window to read.
> textThe text of the window to read.
> itemText of Menu Item
> item(optional) Text of SubMenu item
> item(optional) Text of SubMenu item
> item(optional) Text of SubMenu item
> item(optional) Text of SubMenu item
> item(optional) Text of SubMenu item
> item(optional) Text of SubMenu item
>
>
> Return Value
> Success:Returns 1.
> Failure:Returns 0 if the menu could not be found.
>
>
> Remarks
> You should note that underlined menu items actually contain a &
> character to
> indicate the underlining. Thus, the menu item File would actually
> require the
> text "&File", and Convert would require "Con&vert" You can access menu
> items
> up to six levels deep; and the window can be inactive, minimized, and/or
> even
> hidden.
>
> WinMenuSelectItem will only work on standard menus. Unfortunately, many
> menus
> in use today are actually custom written or toolbars "pretending" to be
> menus.
> This is true for most Microsoft applications.
>
>
> Related
> ControlCommand, Send
>
> Example
> Set oAutoIt = WScript.CreateObject("AutoItX3.Control")
>
> ' This will select File, Page Setup in notepad
> oAutoIt.WinMenuSelectItem "Untitled - ", "", "&File", "Page Set&up..."
>
> On
> Tue, 23 Dec
> 2008, Andy Borka wrote:
>
>> Date: Tue, 23 Dec 2008 08:35:46 -0500
>> From: Andy Borka <andy@xxxxxxxxxxxxxxxxxxx>
>> Reply-To: jawsscripts@xxxxxxxxxxxxx
>> To: jawsscripts@xxxxxxxxxxxxx
>> Subject: [jawsscripts] Searching menu structures for a particular menu
>>     item
>>
>> I have a particular menu structure that I need to search through in order
> to
>> get to a particular menu item. I know the text on the menu item I want to
>> find but the placement of the menu items change depending on what "view"
> you
>> are on in the program. How would I go about searching for and then
>> activating the menu item (or giving an error message if it can't be
> found)?
>> Twitter: www.twitter.com/sonfire
>>
>>
>>
>>
>> __________?
>> Visit and contribute to The JAWS Script Repository http://jawsscripts.com
>>
>> View the list's information and change your settings at
>> http://www.freelists.org/list/jawsscripts
>>
> __________?
> Visit and contribute to The JAWS Script Repository http://jawsscripts.com
>
> View the list's information and change your settings at
> http://www.freelists.org/list/jawsscripts
>
> -- 
> Doug Lee, Senior Accessibility Programmer
> SSB BART Group - Accessibility-on-Demand
> mailto:doug.lee@xxxxxxxxxxxxxxxx  http://www.ssbbartgroup.com
> "While they were saying among themselves it cannot be done,
> it was done." --Helen Keller
> __________
> Visit and contribute to The JAWS Script Repository http://jawsscripts.com
>
> View the list's information and change your settings at
> http://www.freelists.org/list/jawsscripts
>
>
> __________?
> Visit and contribute to The JAWS Script Repository http://jawsscripts.com
>
> View the list's information and change your settings at
> http://www.freelists.org/list/jawsscripts
>
> -- 
> Doug Lee, Senior Accessibility Programmer
> SSB BART Group - Accessibility-on-Demand
> mailto:doug.lee@xxxxxxxxxxxxxxxx  http://www.ssbbartgroup.com
> "While they were saying among themselves it cannot be done,
> it was done." --Helen Keller
> __________
> Visit and contribute to The JAWS Script Repository http://jawsscripts.com
>
> View the list's information and change your settings at
> http://www.freelists.org/list/jawsscripts
>
>
> _______________________________________
> No viruses found in this incoming message
> Scanned by iolo AntiVirus 1.5.6.3
> http://www.iolo.com
> 

__________ 
Visit and contribute to The JAWS Script Repository http://jawsscripts.com

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

Other related posts: