jrizzo Posted December 15, 2022 Report Share Posted December 15, 2022 Most programs have menu items with no keyboard shortcuts. I'd like to create a macro to select a menu item in a program, but I don't see any way of doing this. I've looked and looked within the program and I've checked the user forums. This seems like it should be pretty easy/simple, but it is definitely not obvious. Can anyone provide any insight? TIA. Quote Link to comment Share on other sites More sharing options...
Cory Posted December 15, 2022 Report Share Posted December 15, 2022 I first try to use the Windows Controls commands in MEP. This is by far the best way to interest with controls. However many newer UWP programs have different controls that are invisible to MEP. I typically start with the Get Control command. There's a control picker utility in there. If you hover the blue X over the control and it highlights it, then it will work. Next I will try hitting the Home (sometimes with Ctrl) button then tabbing though the controls counting. All windows programs should be able to tab to with the keyboard. As a last resort I will use the mouse. Mouse moves and clicks are problematic becasue the environment changes. Like a toolbar is enabled or a font size changes and then it fails and click in the wrong place . Aside: Windows controls commands are better for many other reasons. One big one is timing as there is a handy "Wait for control" command. Many people avoid Windows controls because it seems complicated and people get intimidated. They're not and should be one of the first things an MEP programmer learns as it will pay huge dividends into the future. If you don't know how, we can give you an edification. Quote Link to comment Share on other sites More sharing options...
acantor Posted December 15, 2022 Report Share Posted December 15, 2022 The standard method to give keyboard input focus to the menu bar is to press either Alt or F10. If the menu bar (or ribbon) can be interacted with via keyboard, focus will jump there, and you will see it. Then menu items can be activated via arrow keys and/or "accelerator" keys. For example, for the File menu, pressing Alt or F10 will change the appearance of File: the "F" will be highlighted, or underlined. If this method works, a macro to navigate through menus can be simple. In pseudo code: Type F10 // Activate the menubar Type F // Choose the _F_ile menu Type A // Choose Save _A_s Sometimes you will need to insert a short delay between certain steps. 100 to 200 milliseconds is usually enough. Quote Link to comment Share on other sites More sharing options...
Cory Posted December 15, 2022 Report Share Posted December 15, 2022 Please tell us what the program is and what control you're trying to access. A screenshot woudl be helpful also. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.