Jump to content
Sign in to follow this  
BeakerMcChemist

using WinMenuSelectItem with partial item name

Recommended Posts

BeakerMcChemist

I need to select a menu item using WinMenuSelectItem, but the menu item name changes depending on the name of the file open. However it always has the word "Movie" near the beginning. I tried to set WinTitleMatchMode =2, but as far as I can tell that only works on the Window Title, not menu items.

This code works:

WinMenuSelectItem($sProgName,"", "&Window", "&2 Movie water drops.mdb 8/25/2015 10:05:27 AM  by CA System")

But I would like to be able to use something like this and have the program pick the menu item that has the word "Movie" in it.

WinMenuSelectItem($sProgName,"", "&Window", "Movie")

 

I know WinMenuSelectItem works because I use it elsewhere in the program.

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

    • BigDaddyO
      By BigDaddyO
      I'm using WinMenuSelectItem() successfully in the application I'm automating but i'm looking for another feature.
      I use WinMenuSelectItem to Process a record.
      I then need to use WinMenuSelectItem to Save the record, but I shouldn't save before the Process step above finishes (Save option is always enabled).
      Sadly, the only way to know if Processing actually finished is when another menu item gets enabled (but I don't want to select that other menu item, just wait until it's enabled)
       
      The AU3Info tool doesn't show me anything for the menu bar items so I can't use ControlCommand IsEnabled.
       
      Anybody have other ideas?
       
      Quick example using SciTE menu bar as they act the same, AU3Info can't see those menu items either.
      ;Undo in SciTE, then wait until Redo is enabled but dont click it. If WinMenuSelectItem("[CLASS:SciTEWindow]", "", "&Edit", "&Undo") Then ConsoleWrite("Undo clicked" & @CRLF) ;How to I know if "&Edit", "&Redo" is enabled? Else ConsoleWrite("Can't find Undo" & @CRLF) EndIf ;Erase this line then run/F5 to get back  
       
      Thanks,
      Mike
    • IgImAx
      By IgImAx
      Hi
       
      UPDATED Notes: ===============================================================================
      UPDATED: My main and second questions answered. Here the answers:
      To add/access WinMenuSelectItem you need to [Thanks to Fernando_Marinho]: Add AutoItX.Dotnet in Manage NuGet Packages Right Click in your Project -> Add -> Reference... -> COM ( Type Libraries )than, check the option AutoItX3 1.0 Type Library  using AutoItX3Lib; AutoItX3 au3 = new AutoItX3(); au3.WinMenuSelectItem("", ...) My full source code in C# exists in 11 posts in below. How to access those overloaded methods in AutoitX3 that are not accessible via above method!? Or how to fix AutoitX3 DLL Registration need in target computers without Autoit pre-installed on them!? Please check my post at 14 posts below!
      =============================================================================== Original Post:
       
       
      I was writing a small app in Autoit to close µTorrent app. It was working. Then I try to import AutoItX into C#, but unfortunately this method
      WinMenuSelectItem Couldn't find by IntelliSense and If I typed completely it still give me this message:
      Please check the image. I Google it and I found this QA at stackoverflow: Autoit error within C# application I saw they use this line:
      au = new AutoItX3Lib.AutoItX3Class(); I figure it how to add 'AutoItX3Lib' to project (by adding 'AutoItX3.dll' to reference) but again! When I use this line:
      var au = new AutoItX3Class(); I got this error message: Interop type 'AutoItX3Class' cannot be embedded. Use the applicable interface instead.
      My system info:
      Visual Studio 2017 Enterprise - v15.5.4
      X64 Windows 10 Enterprise 1607
      Thanks in advanced
      IgImAx

×