Open & Select Popup Menu Item not working as expected
Hi all
In Logic Pro X, you can add a plugin slot before all occupied by clicking on the thin strip above the plugin slot list.

You can click on it, navigate to the desired plugin and select and it will load before all others. However Open & Select popup menu doesn't see any of the menu items in this popup menu. If I use the same code that will open up a plugin on the first slot, but instead point it to this popup, it suddenly cant see the options. Any help would be greatly appreciated! :)
sf.ui.app("com.apple.logic10").children.whoseRole.is("AXWindow").allItems[1].groups.whoseDescription.is("Inspector").first.children.whoseRole.is("AXList").first.groups.allItems[3].children.whoseRole.is("AXLayoutArea").whoseDescription.is("Mixer").first.children.whoseRole.is("AXLayoutItem").first.buttons.whoseDescription.is("insert bar").allItems[3].popupMenuSelect({
menuPath: ["EQ"],
});
- AAlex Oldroyd @Alex_Oldroyd8
Hey @Kitch. Is there a way to use get open & select working on this?
Kitch Membery @Kitch2022-02-07 21:15:39.254Z
I'll take a look :-)
- AAlex Oldroyd @Alex_Oldroyd8
Hero!! :)
Kitch Membery @Kitch2022-02-07 21:34:45.162Z
Not yet I'm not hahaha :-)
- AAlex Oldroyd @Alex_Oldroyd8
Lol . whenever you can will be much appreciated mate :)
- In reply toAlex_Oldroyd8⬆:Kitch Membery @Kitch2022-02-07 22:46:12.257Z
Hi @Alex_Oldroyd8,
This should do the trick :-)
/** * @param {object} obj * @param {number} obj.insertBarNumber * @param {string[]} obj.menuPath */ function addToInsertBar({ insertBarNumber, menuPath }) { const logic = sf.ui.app('com.apple.logic10'); logic.appActivateMainWindow(); const inspector = logic.mainWindow.groups.whoseDescription.is('Inspector').first; const mixer = inspector.children.whoseRole.is("AXList").first.groups.allItems[2].children.whoseRole.is("AXLayoutArea").whoseDescription.is("Mixer").first const insertBar = mixer.children.whoseRole.is("AXLayoutItem").first.buttons.whoseDescription.is("insert bar").map(e => e).reverse()[insertBarNumber - 1]; const popupMenu = insertBar.popupMenuOpenFromElement({ relativePosition: { "x": 60, "y": 3 }, }).popupMenu; popupMenu.popupMenuSelect({ menuPath, }); } addToInsertBar({ insertBarNumber: 1, menuPath: ["EQ", "Channel EQ", "Dual Mono"], });
Rock on!
- AAlex Oldroyd @Alex_Oldroyd8
Thanks mate. I'm getting the following error and I can't work out the issue...
08.02.2022 00:02:25.17 <info> [Backend]: JavaScript error with InnerException: null !! Command Error: 1 Add plugin before list [user:ckytyz33500008210mg0auixy:ckyu2dk4s000n82109qxisgd5]: TypeError: Cannot read property 'popupMenuOpenFromElement' of undefined (1 Add plugin before list line 14)
Kitch Membery @Kitch2022-02-08 00:07:02.230Z
Heading out for a bit but will check it on my return :-)
Try playing around with the
relativePosition: { "x": 60, "y": 3 },
Maybe change it to
relativePosition: { "x": 50, "y": -4 },
- In reply toAlex_Oldroyd8⬆:
Kitch Membery @Kitch2022-02-08 00:08:17.204Z
If that does not work could you upload a screenshot?
- In reply toAlex_Oldroyd8⬆:
Kitch Membery @Kitch2022-02-08 03:39:27.009Z
Here is a new and improved version;
/** * @param {object} obj * @param {number} obj.insertBarNumber * @param {string[]} obj.menuPath */ function addToInsertBar({ insertBarNumber, menuPath }) { const logic = sf.ui.app('com.apple.logic10'); logic.appActivateMainWindow(); const inspector = logic.mainWindow.groups.whoseDescription.is('Inspector').first; const mixer = inspector.childrenByRole("AXList").first.groups.find(c => { return c.children.whoseRole.is("AXLayoutArea").first.getString("AXDescription") === "Mixer" }).children.whoseRole.is("AXLayoutArea").whoseDescription.is("Mixer").first; const insertBar = mixer.children.whoseRole.is("AXLayoutItem").first.buttons.whoseDescription.is("insert bar") .map(e => e).reverse()[insertBarNumber - 1]; const popupMenu = insertBar.popupMenuOpenFromElement({ relativePosition: { "x": 60, "y": 3 }, }).popupMenu; popupMenu.popupMenuSelect({ menuPath, }); } addToInsertBar({ insertBarNumber: 1, menuPath: ["EQ", "Channel EQ", "Dual Mono"], });
I wasn't taking into account the Groups or or Help Inspectors being visible.
Give this a run :-)
- AAlex Oldroyd @Alex_Oldroyd8
@Kitch you are a god. This is amazing. As long as there is a plugin in slot 1, it works every time on audio, instruments and auxes! :)
I'll make a script that includes an if/else statement to check if there are other plugins on the channel.
How would you go about doing this on multiple selected tracks... Do you think it would be better in the mixer window or is there a way to do it in the arrange window?