Jump to content
Sign in to follow this  

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

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

Share this post

Link to post
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.


Share this post

Link to post
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

Share this post

Link to post
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!


Share this post

Link to post
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
Sign in to follow this  

  • Similar Content

    • kelso
      By kelso
      Hello Guru's,
      I'm trying to write an autoit script to select from the dropdown list as you see in the attached picture. 
      I read the help page for _IEFormElementOptionSelect, but I cannot grasp how to correlate that with the source code that I'm seeing. any suggestions?

    • jloyzaga
      By jloyzaga
      I'm trying to read an excel spreadsheet(SWW_TestFlow, Worksheet=Controller) and creating a dropdown list from all the cell values within a specific column("G").   
      I would like to have the dropdown behave in such a way as to allow multiple selections and for all those selections to be written to a file.
      I attached a file I started with to experiment with gui and controls etc but got totally lost.......
      Can somebody help me?
    • Cormin
      By Cormin
      I've never worked with an array or dropdown menu before and I can't seem to wrap it around my head this morning.  Maybe I just need more coffee but I'm trying to populate a GUI dropdown menu with section names of a .ini file.  Here is what I have for this part but I don't know where to go from here.  The msgbox thing was only testing it but I kinda got stuck here.
      local $aSectionnames = IniReadSectionNames(@DesktopDir & "\Scripts\BatteryConfig.ini") if Not @error Then For $i = 1 to $aSectionnames[0] MsgBox($MB_SYSTEMMODAL, "Test", $aSectionnames[$i]) Next EndIf  
      Here is my very basic dropdown menu I want to populate
      #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 413, 213, 192, 124) $Combo1 = GUICtrlCreateCombo("Combo1", 80, 24, 241, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) $Button1 = GUICtrlCreateButton("Button1", 152, 56, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd  
    • oddlogic
      By oddlogic
      I was working with an intranet site today and there is a huge combo box that you can click on where it says "All", underneath 'Model' (Capture.png). After selecting a model, there are numerous lines to choose from that do other things, which I can work with perfectly well. I have to deal with other pages similar to this one, but on this particular page the only "firing" event is the choice of the dropdown menu. 
      Here is the source for that particular field:  (The id we care about is "cphBody_rgdModelDrawing_ctl00_ctl02_ctl02_rcbModel")
      <table cellspacing="0" class="rgMasterTable" id="cphBody_rgdModelDrawing_ctl00" style="width:100%;table-layout:auto;empty-cells:show;"> <colgroup> <col /> <col /> <col /> <col /> <col style="width:45px" /> <col style="width:30px" /> </colgroup> <thead> <tr> <th scope="col" class="rgHeader"><a title="Click here to sort" href="javascript:__doPostBack(&#39;ctl00$cphBody$rgdModelDrawing$ctl00$ctl02$ctl01$ctl01&#39;,&#39;&#39;)">Model</a></th><th scope="col" class="rgHeader"><a title="Click here to sort" href="javascript:__doPostBack(&#39;ctl00$cphBody$rgdModelDrawing$ctl00$ctl02$ctl01$ctl02&#39;,&#39;&#39;)">Drawing</a></th><th scope="col" class="rgHeader"><a title="Click here to sort" href="javascript:__doPostBack(&#39;ctl00$cphBody$rgdModelDrawing$ctl00$ctl02$ctl01$ctl03&#39;,&#39;&#39;)">Station Number</a></th><th scope="col" class="rgHeader"><a title="Click here to sort" href="javascript:__doPostBack(&#39;ctl00$cphBody$rgdModelDrawing$ctl00$ctl02$ctl01$ctl04&#39;,&#39;&#39;)">Sort Order</a></th><th scope="col" class="rgHeader">&nbsp;</th><th scope="col" class="rgHeader">&nbsp;</th> </tr><tr class="rgFilterRow"> <td style="white-space:nowrap;"> <div id="cphBody_rgdModelDrawing_ctl00_ctl02_ctl02_rcbModel" class="RadComboBox RadComboBox_Default" style="width:200px;"> <table summary="combobox" style="border-width:0;border-collapse:collapse;table-layout:fixed;width:100%"> <tr class="rcbReadOnly"> <td style="margin-top:-1px;margin-bottom:-1px;width:100%;" class="rcbInputCell rcbInputCellLeft"><input name="ctl00$cphBody$rgdModelDrawing$ctl00$ctl02$ctl02$rcbModel" type="text" class="rcbInput" id="cphBody_rgdModelDrawing_ctl00_ctl02_ctl02_rcbModel_Input" value="All" style="display: block;" readonly="readonly" /></td> <td style="margin-top:-1px;margin-bottom:-1px;" class="rcbArrowCell rcbArrowCellRight"><a id="cphBody_rgdModelDrawing_ctl00_ctl02_ctl02_rcbModel_Arrow" style="overflow: hidden;display: block;position: relative;outline: none;">select</a></td> </tr> </table> <div class="rcbSlide" style="z-index:6000;"><div id="cphBody_rgdModelDrawing_ctl00_ctl02_ctl02_rcbModel_DropDown" class="RadComboBoxDropDown RadComboBoxDropDown_Default " style="float:left;display:none;"><div class="rcbScroll rcbWidth" style="height:200px;width:100%;"><ul class="rcbList" style="list-style:none;margin:0;padding:0;zoom:1;"><li class="rcbItem ">All</li><li class="rcbItem ">019-208-17-3Y</li><li class="rcbItem ">019-208-17-6Y</li><li class="rcbItem ">124-ATR-3/0-L10</li><li class="rcbItem ">124-ATR-3/0-L10M</li><li class="rcbItem ">124-ATR-3/0-L10S</li><li class="rcbItem ">124-ATR-3/0-L13</li><li class="rcbItem ">124-ATR-3/0-L15</li><li class="rcbItem ">124-ATR-3/0-L15M</li><li class="rcbItem ">124-ATR-3/0-L15S</li><li class="rcbItem ">124-ATR-3/0-L18</li><li class="rcbItem ">124-ATR-3/0-L20</li><li class="rcbItem ">124-ATR-3/0-L25</li><li class="rcbItem ">124-ATR-3/0-L30</li><li class="rcbItem ">124-ATR-4/0-L10</li><li class="rcbItem ">124-ATR-4/0-L13</li> .....there are thousands of these parts, listed like this. then at the end of the li tag list.... <script type="text/javascript"> function ModelIndexChanged(sender, args) { var tableView = $find("cphBody_rgdModelDrawing_ctl00"); tableView.filter("ModelDrawing_ModelID", args.get_item().get_value(), "EqualTo"); } </script>  
      I am able to read and write to the dropdown using either _IEGetFormCollection (by index because the page always has the same input indices) or _IEGetObjectById, and then using _IEFormElementSetValue. What I cannot seem to do is to use the "child" method whereby one would address the list object by using _IEFormGetCollection. That returns an error code of either 7 or 2 (it's been a long day. I forget which)
      The problem with writing to the dropdown with setValue is that the form doesn't fire after you change the list box. In fact, it won't even fire if a user clicks on it, then hits return. It is only by changing the value manually and then changing it again that you can get the part number that you want to display as it should. 
      How should one go about selecting the dropdown value that would allow the page to fire as it should? 

      ;this works but doesn't fire - I use formCollection because there are other things that I have to use fields for in this document and the indices don't change Local $oForm = _IEFormGetCollection($oIE, 0) $modelTextBox = _IEFormElementGetCollection($oForm, 7) _IEFormElementSetValue($modelTextBox, $chargerPartNumber)  
    • rm4453
      By rm4453
      I can't seem to figure out how to select  Category and Sub-Category with autoit from a Dropdown in IE.
      I am building this for a private site so I will be unable to give you a link to it, however I have found a form online that is almost exactly the same as the one I am using... Here is the link to it: https://www.ksl.com/index.php?nid=1126
      I need to somehow select a Category and Sub-Category... the site I will be using it on has quite an extensive list for Categories and Sub-Categories so I will need to be able to make sure it is working periodically and posting to the correct categories... "Am building an auto blogger type of software for private use Pls let me know if this is against forum rules!"
          In advanced Thank You for all of your help!
      "P.S. This is part of the code I have figured out so far... (You will have to login to see the form I am talking about...)
      ;Set category! $cat = _IEGetObjById($ie, "cat") ;Set subcategory! $subcat = _IEGetObjByID($ie, "subcat") ;Time to submit the form! $oButtons = _IETagnameGetCollection($ie, "input") For $oButton in $oButtons If String($oButton.value) = "Submit" Then _IEAction($oButton, "click") MsgBox("Success", "Button Clicked", "Next Step!") ExitLoop Else MsgBox("Failed", "The Button " & $oButton & "Does Not Have The Value", "Try Again!") EndIf Next