I have a menu with a submenu and would like to simulate a user interaction where the user clicks on the menu and then on a submenu using ⎕NQ. However, I can only simulate one event; the subsequent ones are not handled unless I intervene by clicking manually somewhere with the mouse.
Here is an example:
CreateMenu
'f' ⎕WC 'Form' ('Caption' 'Menu Test')
'f.menuBar' ⎕WC 'MenuBar'
'f.menuBar.menu' ⎕WC 'Menu' '&One'
'f.menuBar.menu.miA' ⎕WC 'MenuItem' ('Caption' 'Choice A')
'f.menuBar.menu.miB' ⎕WC 'Menu' ('Caption' 'Choice B')
'f.menuBar.menu.miB.miX' ⎕WC 'MenuItem' ('Caption' 'Choice X')
'f.menuBar.menu.miB.miY' ⎕WC 'MenuItem' ('Caption' 'Choice Y')
And here are the events I have tried:
⎕NQ 'f.menuBar.menu' 'Select' ⋄ ⎕DL 0.5 ⋄ ⎕NQ 'f.menuBar.menu.miB' 'Select'
Any clues?
(Remark: in this particular example, if we wanted to simulate a click on, say, "Choice Y", it isn't actually necessary to first ⎕NQ "One" and "Choice B", but ideally, we'd like to see choices being made in the GUI as if an actual user made them.)