How to select menu dropdown item that does not have a letter underlined Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
paquirl
Posts: 51
Joined: 28 Aug 2017, 13:36

How to select menu dropdown item that does not have a letter underlined

27 Sep 2019, 13:41

In the screenshot below, it appears the letter g is underlined for the menu item we want to select, but it is not. How do we make the script select this?
screenshot of EDI bug.png
screenshot of EDI bug.png (29.16 KiB) Viewed 1546 times
User avatar
Capn Odin
Posts: 1308
Joined: 23 Feb 2016, 19:45
Location: Denmark

Re: How to select menu dropdown item that does not have a letter underlined

27 Sep 2019, 13:46

Code: Select all

WinMenuSelectItem, A, , Edit, Process, Foreground from error
Please excuse my spelling I am dyslexic.
User avatar
boiler
Posts: 6646
Joined: 21 Dec 2014, 02:44

Re: How to select menu dropdown item that does not have a letter underlined

27 Sep 2019, 13:51

Try WinMenuSelectItem. It looks like the following may work once you replace WinTitle with the actual title of your window:

Code: Select all

WinMenuSelectItem, WinTitle,, Edit, Process, Foreground from error
However, it doesn't work with all menus, but try it and see.

Edit: @Capn Odin was too fast. :)
paquirl
Posts: 51
Joined: 28 Aug 2017, 13:36

Re: How to select menu dropdown item that does not have a letter underlined

27 Sep 2019, 13:58

The first guy's code does not work. I'm about to test Boiler's.
User avatar
boiler
Posts: 6646
Joined: 21 Dec 2014, 02:44

Re: How to select menu dropdown item that does not have a letter underlined

27 Sep 2019, 14:02

His requires the window to be active. If it was active and it didn't work, then mine won't work either.
paquirl
Posts: 51
Joined: 28 Aug 2017, 13:36

Re: How to select menu dropdown item that does not have a letter underlined

27 Sep 2019, 14:05

Correct, neither code is working.

Is it because SAP has a different kind of dropdown menu??

The window is active because the user manually highlights a line on the report immediately prior to hitting the hotkey.
User avatar
boiler
Posts: 6646
Joined: 21 Dec 2014, 02:44

Re: How to select menu dropdown item that does not have a letter underlined

27 Sep 2019, 14:10

Per the WinMenuSelectItem documentation:
This command will not work with applications that use non-standard menu bars. Examples include Microsoft Outlook and Outlook Express, which use disguised toolbars for their menu bars. In these cases, consider using ControlSend or PostMessage, which should be able to interact with some of these non-standard menu bars.
User avatar
boiler
Posts: 6646
Joined: 21 Dec 2014, 02:44

Re: How to select menu dropdown item that does not have a letter underlined

27 Sep 2019, 14:13

Since you're saying it's an active window, you could probably get away with simply doing some Click commands in the right locations to simulate a person clicking through the menus. You probably need to incorporate some Sleep commands in between.
paquirl
Posts: 51
Joined: 28 Aug 2017, 13:36

Re: How to select menu dropdown item that does not have a letter underlined

27 Sep 2019, 14:17

This is what I have as a first draft, and the only part that is not working is the Send, g line because the g is not really underlined as you can see in the screenshot above. I'm trying to read the Control and SendMessage documents but I'm struggling.

Code: Select all

#Numpad1::
Send, {F8}
Send, !e
Send, p
Send, g
return
User avatar
boiler
Posts: 6646
Joined: 21 Dec 2014, 02:44

Re: How to select menu dropdown item that does not have a letter underlined

27 Sep 2019, 14:22

You could also try using arrow keys like Left and Down to navigate where you otherwise can't, then you can probably select the item using Enter. See if you can do that manually, then just reproduce it in your script.
paquirl
Posts: 51
Joined: 28 Aug 2017, 13:36

Re: How to select menu dropdown item that does not have a letter underlined

27 Sep 2019, 14:28

Like this?

Code: Select all

#Numpad1::
Send, {F8}
Send, !e
Send, Down
Send, Right
Send, Down
Send, Enter
return
User avatar
boiler
Posts: 6646
Joined: 21 Dec 2014, 02:44

Re: How to select menu dropdown item that does not have a letter underlined

27 Sep 2019, 14:32

You need { } around those:

Code: Select all

#Numpad1::
Send, {F8}
Send, !e
Send, {Down}
Send, {Right}
Send, {Down}
Send, {Enter}
return
You may also need some Sleep statements in between if it's not ready to accept each key that fast.
paquirl
Posts: 51
Joined: 28 Aug 2017, 13:36

Re: How to select menu dropdown item that does not have a letter underlined

27 Sep 2019, 14:50

Test failed, but now i will add in the time delays and try again.
Also i'll read up on why the Alt+e does not require brackets lol
User avatar
boiler
Posts: 6646
Joined: 21 Dec 2014, 02:44

Re: How to select menu dropdown item that does not have a letter underlined  Topic is solved

27 Sep 2019, 14:56

You should make sure that those exact keypresses work when you press them on your actual keyboard. If they do work just as you've shown, then it may be the Sleep. Try longer Sleep durations like 300 at first, then you can reduce them.

If none of that works, you can try using Click to click on the menu locations.
hunter99
Posts: 128
Joined: 20 Jan 2014, 17:57

Re: How to select menu dropdown item that does not have a letter underlined

27 Sep 2019, 16:58

Hi paquirl, try this:

#Numpad1::sendinput !ep{Down}{Enter}return

If that doesn't work maybe using a sendmessage.
SendMessage, 0x111, %vkey%, 0, , %vTarget%

Replace %vkey% with the wParam its the control ID.
The 0x111 says its a Wm_command.
The %vTarget% is the windows Title.

These two links will get you scripts to get the control ID.
;AHK v1.1 x64/x32 compatible update by jeeswg of the script, by Micha, at:
;Get Info from Context Menu - Scripts and Functions - AutoHotkey Community
https://autohotkey.com/board/topic/19754-get-info-from-context-menu/

;by lexikos 07 Jun 2015, 22:52 Alt Menu Search
http://ahkscript.org/boards/viewtopic.php?f=6&t=8085

good luck, hunter99
paquirl
Posts: 51
Joined: 28 Aug 2017, 13:36

Re: How to select menu dropdown item that does not have a letter underlined

04 Oct 2019, 14:39

I increased the first sleep command to 750 because of the delay moving to next screen prior to the ALT+E. This script now works!

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], famko, Google [Bot], teadrinker and 37 guests