On the one hand, KM can do anything. On the other hand, the reliable way to solve a problem like this is to use AppleScript (or use Keyboard shortcuts that the app provides, if any.) I have no idea if your app supports AppleScript sufficiently to do this easily and accurately. As for keyboard shortcuts, you should look through the menus to see if these are available there.
But if neither of those ideas pan out, there is a tricky solution using screen reading (optionally, using OCR.) Whether this works for you depends upon trial and error and the exact nature of the pop-up menu. In this case, I think I could get it to work, but perhaps only if I had the app, because this approach requires a lot of finessing. For example, I'd need to see the physical position of the pop-up. Your screen image shows it, but your screen image doesn't show if the position changes based on where you click in the box, or whether the position changes if your window is close to the top of the screen. There are lots of tricky scenarios here, and if I could get it to work, it might take 2-3 seconds to do this, and I'm not sure if that's fast enough for your requirements.
So plan A is for you to find out if your app supports AppleScript, and if so ask someone how to execute this using that. Plan B is to check if your app has keyboard shortcuts for these menu items (probably not.) And Plan C is to either give up or do some tricky screen analysis.
Those are my ideas. And I'm running about 80% correct answers this week.