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

  • From: Jamal Mazrui <empower@xxxxxxxxx>
  • To: jawsscripts@xxxxxxxxxxxxx
  • Date: Wed, 24 Dec 2008 11:20:31 -0500 (EST)

Oh, a Mozilla-based application!  That menu technique only works with
standard Windows menus.  Mozilla-based apps are some of the most
difficult to script because they use the same window class for almost
everything.  There are no unique control IDs, etc.  The best approach
might be a JavaScript add-in, but that would not be as integrated with
JAWS.

Jamal
On Wed, 24 Dec 2008, Andy Borka wrote:

> Date: Wed, 24 Dec 2008 11:15:09 -0500
> From: Andy Borka <andy@xxxxxxxxxxxxxxxxxxx>
> Reply-To: jawsscripts@xxxxxxxxxxxxx
> To: jawsscripts@xxxxxxxxxxxxx
> Subject: [jawsscripts] Re: Searching menu structures for a particular
>     menu item
>
> That's ok. I used windig on the program and it couldn't find a whole lot
> about it. No menus, no hotkeys, no child windows with unique names and all
> the classes for every control in the program was exactly the same thing. The
> program I am looking at is Thunderbird 2.0.18. Is there any recommendations
> on the program? Should I script for it or just abandon the whole thunderbird
> idea?
>
>
> Twitter: www.twitter.com/sonfire
>
>
> -----Original Message-----
> From: jawsscripts-bounce@xxxxxxxxxxxxx
> [mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of Jamal Mazrui
> Sent: Wednesday, December 24, 2008 10:06 AM
> To: jawsscripts@xxxxxxxxxxxxx
> Subject: [jawsscripts] Re: Searching menu structures for a particular menu
> item
>
> I found a message I previously wrote explaining the SendMessage (or
> PostMessage) technique for invoking a menu item.  Once again, WinDig is
> available at
> http://EmpowermentZone.com/wdsetup.exe
>
> You can get almost any of my programs from the Open Source Projects page
> of
> http://NonvisualDevelopment.org
>
> Jamal
>
> From: Jawsscripts-bounces@xxxxxxxxxxxxxxxxxxxx on behalf of Jamal Mazrui
> [empower@xxxxxxxxx]
> Sent: Friday, September 23, 2005 6:36 AM
> To: jawsscripts@xxxxxxxxxxxxxxxxxxxx
> Subject: Using WinDig output to invoke menu choices via SendMessage
>
> In the "Menus" section of WinDig output, the last piece of data on the
> line for a menu item is its menu ID--if one exists.  If a menu item does
> not have a hot key but does have a menu ID, you can create a hot key via a
> JAWS script and the SendMessage function.  For example, the following line
> of WinDig output is about the Paste Special menu item of WordPad:
>
> 2.5   Paste Special...        S       57639
>
> The 2.5 number is the outline number of the menu hierarchy, indicating
> that the menu item is the fifth one down the second menu, the Edit menu.
> The ... ellipses indicate that the menu item presents a dialog.  S is the
> access letter, indicating that you can press it when the Edit menu is
> dropped down to invoke this menu item.  Finally, the 57639 number is the
> menu ID, similar to a control ID.
>
> This review of the WinDig output for WordPad showed no accelerator key for
> PasteSpecial but a menu ID was available.  I am not suggesting that
> scripts are needed for every menu item without a hot key--this is just to
> illustrate the technique, and you would judge whether such a script adds
> significant value in the context of the application.
>
> Although it is also possible to invoke a menu item by sending keystrokes
> to the application, that technique is less reliable because it is affected
> by the current keyboard focus.  It also tends to produce extra speech
> which you may then need to silence with SpeechOff and Delay functions.
>
> The SendMessage approach, on the other hand, does not actually activate
> and navigate the menus of the application's user interface.  It uses a
> Windows message constant, WM_COMMAND, which is passed with a menu ID to
> the application window associated with the menu of interest.  The relevant
> window handle is usually the one returned by GetAppMainWindow, but the
> InvokeMenuItem wrapper function below does not assume this in case you
> wish to use another window, including a window of an application other
> than the one with focus.
>
>   The code below consists of a generic function called InvokeMenuItem, and
> a sample script called PasteSpecial, which might be attached to
> Control+Shift+V. Note that a limitation of this approach is that it only
> works if the application implements standard menus of the Win32 API.
> Unfortunately, many applications do not, such as those in the Microsoft
> Office suite.
>
> Jamal
>
>
> Int Function InvokeMenuItem(Handle h, Int i)
> Var
> Int WM_COMMAND
>
> Let WM_COMMAND = 273
> Return SendMessage(h, WM_COMMAND, i, 0)
> EndFunction
>
> Script PasteSpecial()
> Var
> Handle h,
> Int i
>
> Let h = GetAppMainWindow(GetFocus())
> Let i = 57639 ; menu ID of Paste Special in WordPad
>
> InvokeMenuItem(h, i)
> EndScript
>
>
> _____________________________________________________________
>
> To leave this list, send a blank message to
> jawsscripts-unsubscribe@xxxxxxxxxxxxxxxxxxxxx
> Information about all of our lists:
> http://blindprogramming.com/mailman/listinfo
> Other blindness lists:
> http://www.visionrx.com/library/resources/resource_int1.asp
> Web site address: http://www.BlindProgramming.com
>
>
> _______________________________________________
> Jawsscripts mailing list
> Jawsscripts@xxxxxxxxxxxxxxxxxxxx
> http://blindprogramming.com/mailman/listinfo/jawsscripts_blindprogramming.co
> m
>
> __________
> 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
>
__________ 
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: