No internet connection
  1. Home
  2. How to

How to click buttons inside a plug-ins

By Ammon Hottel @Ammon_Hottel
    2023-09-03 02:29:10.190Z

    Hi guys, I’m trying to do what I thought was simple…
    I’m just wanting to activate some buttons in a plug-in window, and trigger them from my stream deck.
    I used the UI element picker to find the pathway to the button.
    But every button comes back with the same pathway… FX TDM edit view
    I have been messing with this for hours
    Thank you for any answers
    The plug-ins are Plug-in alliance the BX Consol collection
    They have undo, redo, copy, paste, and random all channels buttons
    Just want them on my deck

    • 2 replies
    1. Nathan Salefski @nathansalefski
        2023-09-03 04:37:04.384Z

        You need to use mouse mouseClickElement({ relativePosition: {"x":-1,"y":-1} });. If your plugin window is open this is a very easy way to do it:

        sf.ui.proTools.appActivateMainWindow();
        sf.ui.proTools.invalidate()
        
        // This will define your Plug-in Window. Be sure to change "PLUGIN NAME HERE" to the name of your Plug-in
        let pluginWin = sf.ui.proTools.windows.whoseTitle.is("Plug-in: PLUGIN NAME HERE").first
        
        function clickButton() {
            // This will get the current position of your mouse
            let position = sf.mouse.getPosition().position;
        
            // This will define the frame of your Plug-in Window
            let f = pluginWin.frame;
        
            // This will move your mouse to the parameter location.
            // Be sure to change the coordinates to match the parameters location
            sf.mouse.setPosition({ position: { x: f.x + 415, y: f.y + 95 } });
        
            // This will click you mouse at the parameter location
            // Be sure to change the coordinates to match the parameters location
            sf.mouse.click({ position: { x: f.x + 415, y: f.y + 95 } });
        
            // This will return your mouse to its original position
            sf.mouse.setPosition({position});
        }
        
        // This will perform all of the above actions in one go
        clickButton();
        

        This package by @Chris_Shaw is a God send for this. Find it in the store and install it!

        Hope that helps!

        1. In reply toAmmon_Hottel:
          Kitch Membery @Kitch2023-09-04 18:59:58.336Z

          Hi @Ammon_Hottel,

          Please watch this video to learn how and when to use the Macro Action "Mouse Click Relative to UI Element".