According to the dm-script manual, the ChooseMenuItem function simulates clicking on a menu item. I'm trying to simulate menu clicks using the following commands:
ChooseMenuItem("Help", "User Mode", "Power User")
ChooseMenuItem("Window", "Floating Windows", "Output")
ChooseMenuItem("Process", "", "FFT")
Only the first command seems to work. I'm wondering whether the issue lies in my usage of ChooseMenuItem (such as wrong parameters or order), or if there is a limitation in dm-script that prevents the other two commands from functioning as expected.
Questions:
Any insights or examples on correctly simulating menu clicks with ChooseMenuItem would be appreciated.
The command doesn't really simulated a click, it rather attempts to find the according menu entry and calls the associated function. But yes, there are limitations to what the command can do. (In particular since GMS 3.x which had a UI overhaul that changed some menus.)
Having said that, I've just tested the three commands above on my machine.
ChooseMenuItem( "Help" , "User Mode" , "Regular" ) // or "Power User" or "Service"
Works as it should.
ChooseMenuItem( "Window" , "Floating Windows" , "Output" )
Does not work. I think this is one which isn't working because the
way GMS 3.6 changed its UI.
But there really is no need for that one neither, as you can use: OpenOutputWindow()
directly.
ChooseMenuItem("Process","","FFT")
works, but there you have to be careful: The menu item is only available (not greyed out) when a suitable image window is front most. With the script-window front-most, the command is not available and the script hence fails. You may want to do something like the below, if you run the script form the script editor window:
GetFrontImage().SelectImage()
ChooseMenuItem("Process","","FFT")
In general, I would advice against using ChooseMenuItem()
in most situations, in particular when the according functionality is accessible directly.