user-interfacecommanddm-script

Is there a limitation or misuse in ChooseMenuItem for simulating menu clicks in dm-script?


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.


Solution

  • 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.

    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.