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

  • From: Jamal Mazrui <empower@xxxxxxxxx>
  • To: jawsscripts@xxxxxxxxxxxxx
  • Date: Tue, 23 Dec 2008 14:37:38 -0500 (EST)

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

Other related posts: