No internet connection
  1. Home
  2. Support

Popup Menu click and Button press in Reaper (updated)

By Ryan Franks @Ryan_Franks
    2025-07-12 16:41:51.858Z

    Title

    Popup Menu click and Button press in Reaper (updated)

    What do you expect to happen when you run the script/macro?

    This script is designed to use Reaper actions to get the timecode position of the edit cursor. Then SF needs to wait for the popup which says "Timecode Copied / copied timecode ##:##:##:##" and click the only button visible, which is "OK". Then reaper will run another string of actions to change from a subproject to the master project and run the action "go to" timecode which will open another window in which SF will need to 'press' command-v and then 'enter'.

    Are you seeing an error?

    12.07.2025 11:36:31.45 [Backend]: !! Command Error: Copy Bars and Cues from SubProject to Master [user:cmd08v42u00008o101h6crvtn:cmd08x4bw00028o10t27ses8h]: Element is required (Copy Bars and Cues from SubProject to Master: Line 10)

    << Command: Copy Bars and Cues from SubProject to Master [user:cmd08v42u00008o101h6crvtn:cmd08x4bw00028o10t27ses8h]

    What happens when you run this script?

    Right now the Reaper action runs and the popup window appears, but then nothing happens. i manually click "ok" in the popup and then i receive the error.

    How were you running this script?

    I used a Stream Deck button

    How important is this issue to you?

    5

    Details

    {
        "inputExpected": "This script is designed to use Reaper actions to get the timecode position of the edit cursor. Then SF needs to wait for the popup which says \"Timecode Copied / copied timecode ##:##:##:##\" and click the only button visible, which is \"OK\". Then reaper will run another string of actions to change from a subproject to the master project and run the action \"go to\" timecode which will open another window in which SF will need to 'press' command-v and then 'enter'. ",
        "inputIsError": true,
        "inputError": "12.07.2025 11:36:31.45  [Backend]: !! Command Error: Copy Bars and Cues from SubProject to Master [user:cmd08v42u00008o101h6crvtn:cmd08x4bw00028o10t27ses8h]:\nElement is required (Copy Bars and Cues from SubProject to Master: Line 10)\n\n<< Command: Copy Bars and Cues from SubProject to Master [user:cmd08v42u00008o101h6crvtn:cmd08x4bw00028o10t27ses8h]",
        "inputWhatHappens": "Right now the Reaper action runs and the popup window appears, but then nothing happens. i manually click \"ok\" in the popup and then i receive the error. ",
        "inputHowRun": {
            "key": "-MpfwmPg-2Sb-HxHQAff",
            "title": "I used a Stream Deck button"
        },
        "inputImportance": 5,
        "inputTitle": "Popup Menu click and Button press in Reaper (updated)"
    }

    Source

    var commandName = `ReaRanger Copy SubProject TIMECODE`;
    var cmd = sf.app.reaper.getAllCommands().commands.find(c => c.name === commandName);
    if (!cmd) throw `Command "${commandName}" was not found`;
    var cmdId = cmd.commandId;
    
    sf.app.reaper.runCommand({
        commandId: cmdId,
    });
    
    sf.ui.app("com.cockos.reaper").windows.whoseDescription.is("alert").first.getElement("button").popupMenuFetchAllItems({
        relativePosition: {"x":0,"y":0},
    })
    
    
    
    
    
    

    Links

    User UID: ewU3L2DFMdYAaMCeXOgqQORCHiq1

    Feedback Key: sffeedback:ewU3L2DFMdYAaMCeXOgqQORCHiq1:-OUzVvT8Z0qnDjVXIIbq

    Feedback ZIP: L1zX7dfYtlJ0y+JQicdAXFBPCEjKHVOEly83knkxcO2xN9vClG979aLq1fqexwE9pU7JRhSDiWuZwKkBCmiUNK6hO+psnjrcN5rOeL3E0Y+wMwTIXfSlB4uq2JoE2o387aDTjr7rEkP/6egzBX82fyAL/n9AuH/sxddPRz53H4r0nFOMBgmgHtZGvlazCbXQKObpwnzoopp8jvjO7LLxBFDXjcnAOMPfuPfBEyEVb0SqIe/dZpTqX9P6VHYdpUe1Q9z8dkkCwCe8/vfxH1utkpdwUQfiQQEc0shu/ZZmexxNMcSsUAFcvHBmoYNFZTO6H1G5/P208awWblP/yEo9Dq6AaVEX+JhEwkf5JFHUCKs=

    • 1 replies
    1. Hi Ryan,

      Awesome that you're starting to incorporate UI automation with the Reaper API. Can't wait to see what you can build by combining them.

      For this type of scenario, you'll need to use an instruction that allows SF to wait for the window to appear before trying to click the element inside of it.

      Inserting this should be enough (before your popup click):

      sf.ui.app("com.cockos.reaper").windows.whoseDescription.is("alert").first.elementWaitFor();
      

      You can learn more about how to use UI automation in the following 2 (somewhat old, but still good) videos: