Jump to content

Newbie questions about selecting menu items in arbitrary third-party apps


Mbee
 Share

Recommended Posts

  I've read many discussions in this forum that relate to that question, but I haven't found anything that answers my questions (for example, several threads relate to self-built AutoIt GUI scripts, but I just want to automate any of a number of already-existing third-party apps).

I know that those trying to help us newbs prefer concrete code examples, and I will provide such next.  But please keep in mind I want to know how to do this in any general case, not just this specific example.  Here, I'm attempting to select the "Compare files" menu item in the "Actions" menu of a third-party app, as follows:

$L_Stat = WinMenuSelectItem( $Cmy_AppTitle, "", "&Actions", "Comp&are files" )

(The menu item name shows the letter "a" in "Compare" to be underlined, so I inserted the "&" as instructed)

As you can see, I tried using WinMenuSelectItem(), but that call returned an error ($L_Stat was 0).  I also tried it without the ampersand in the menu item text, but although that didn't return an error, it also had no effect at all.

However, as the Remarks section in the help file notes: WinMenuSelectItem() will only work on standard menus. Unfortunately, many menus in use today are actually custom written or toolbars "pretending" to be menus.

Question 1: How can I know whether any arbitrary app uses standard menus or fake ones?

Naturally, I tried running Au3Info.exe, but I couldn't find any way to use it to get any information at all about menu items using the Finder Tool.

Question 2: Is there any way to use Au3Info.exe to show all the class and other detailed info about menus and all menu items, whether they're standard or simulated (fake)?

When I tried using the Finder Tool, no menus would ever drop down so I could examine their elements.

If I could discover all that info, perhaps I could try to use the ControlCommand() function, but even then I can't quite determine what arguments I should use for that function.  I believe that function needs much better and more thorough documentation of how it should be used...

Question 3: How the heck is one supposed to figure out what argument values to use with ControlCommand()?   

For example, on that function's documentation page (http://www.autoitscript.com/autoit3/docs/functions/ControlCommand.htm), under the heading "Command, Option", one entry reads: "ShowDropDown", "".  To me, that means that the second parameter, "Option", must always be an empty string, so how on earth is one supposed to specify which dropdown menu to bring down?

But perhaps that's not the correct way to begin to select a menu item with a fake (non-standard) menu.

Question 4: What IS the correct way to select any arbitrary menu item in any arbitrary third-party (non-AutoIt) application when the app uses non-standard (fake) menus?  And how do I determine what argument values to use?

 

I'm sorry for the long post, but as I indicated initially, I'm a newbie with no good idea what the correct way to do these things are. :  Thanks for your patience!

 

(I'm using AutoIt v3.3.10.1 under 32-bit Windows XP Pro/SP3)

Edited by Mbee
Link to comment
Share on other sites

Hi Mbee,

  In an attempt to help you with the main problem - #4.

In my book - the corrct way is the one that works;-)

If you are having trouble with the conventional methods... You mentioned one of the chars was underlined which means you shpould be able to call it by Send (ing) or ControlSend (ing) ALT or CTRL with the underlined letter.

Bill

Link to comment
Share on other sites

Thanks for your quick reply, dabbler.  I appreciate it, however, I'd really like all four of my questions answered in the fully general sense, and ideally in fairly verbose detail.

As an aside: For the one specific case I mentioned in my OP, even manually pressing ALT+a does nothing at all but make the app beep in complaint.  It has no effect.  In order for it to actually do what I want, I have to manually pull down the full menu item in question.  Nothing else has any effect.

Edited by Mbee
Link to comment
Share on other sites

That is correct. You will have to activate the main menu first by sending ALT +  (its Underlined char)

For instance in Notepad:

ALT + F activates the File menu than additional "A" will open the "save as" Dialog.

As for your other questions, there will be others to chime in as the day rolls on :-)

good luck!

Bill

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...