Trouble with the "Select Menu Item" in Logic Pro X
System Information
SoundFlow 4.3.6
OS: darwin 19.6.0
ProductName: Mac OS X
ProductVersion: 10.15.7
BuildVersion: 19H1519
Steps to Reproduce
- Click the "View" Menu
- Click the "Show Colors" Item (if color palette is hidden)
Expected Result
To ensure that the color palette is open
Actual Result
I get an error saying that Soundflow cannot find the menu item "Show Colors"
Workaround
No
Other Notes
The menu item is exactly correct in the code within this package, but soundflow still fails to ensure that the color palette is visible.
Links
User UID: WWHyJTVwU4Q9ZeFTKI7lFTJbUQx2
Feedback Key: sffeedback:WWHyJTVwU4Q9ZeFTKI7lFTJbUQx2:-Mo9_SeahATf6B8ZIo7q
Linked from:
- Kitch Membery @Kitch2021-11-10 22:05:19.318Z
I'm sorry you are experiencing an issue with this.
Can you share your script or a screenshot of the macro you have created for Clicking "View", "Show Colors"?
Thanks in advance. :-)
- In reply toAlexandre_Hirlinger⬆:Kitch Membery @Kitch2021-11-10 22:08:44.298Z
Ohhh... I just found this function in my personal scripts. It should ensure the Color Palette is showing.
function ensureColorPaletteIsOpen() { var logic = sf.ui.app('com.apple.logic10'); //Open Logic Pro X logic.appActivateMainWindow(); //If the Color Palette is not open, Click menu item View -> Show Colors if (!logic.windows.whoseTitle.is('Color').exists) { logic.menuClick({ menuPath: ["View", "Show Colors"], }); } } ensureColorPaletteIsOpen();
Let me know if it works for you :-)
Alexandre Hirlinger @Alexandre_Hirlinger
Hey Kitch! I apologize, I think we have about three different threads going on this same topic, haha. I have the same issue with this script that I have been having - it doens't work at first; however, if I manually input the text "view" and "show colors" into the script, then it works for a little while. I've also noticed that it works if the last menu that I selected was the "view" menu; however, if I navigate to a different menu and then try and run the command, it fails. Hopefully that info gives a little bit more context.
Kitch Membery @Kitch2021-11-11 18:58:55.343Z
Great sleuthing @Alexandre_Hirlinger!
I'll see if I can reproduce this issue here :-)
Alexandre Hirlinger @Alexandre_Hirlinger
After playing around with it a little bit more, I'm not directly sure if the menu click thing has any correlation. I thought it might have, but I could be wrong. Seems to be fairly inconsistent, that may be one of the factors. I feel like it mostly happens when I first open sessions, and then sometimes I can get it to work consistantly for a little bit, but then it still randomly fails.
I was messaging @chrscheuer in a different thread - I'm curious if SF is struggling because its a dynamic menu item (aka it switches depending on the state of the selected item - i.e. it says "show colors" if the color palette is not showing, or it says "hide colors" if the color palette is showing). In other applications I've tried scripting with SF, I believe I've had similar issues with "dynamic" menu items.
Kitch Membery @Kitch2021-11-11 19:07:24.742Z
I can reproduce the issue here... I'm going to try a few things and see if I can figure it out. :-)
Will Keep you posted.
- In reply toAlexandre_Hirlinger⬆:
Kitch Membery @Kitch2021-11-11 19:35:37.333Z
It seems that the menu item needs to be pulled into focus before it will work properly.
Try this script. and let me know if it works for you.
function ensureColorPaletteIsOpen() { var logic = sf.ui.app('com.apple.logic10'); //Open Logic Pro X logic.invalidate(); logic.appActivateMainWindow(); //If the Color Palette is not open, Click menu item View -> Show Colors if (!logic.windows.whoseTitle.is('Color').exists) { //Click the "View" menu before clicking the "Show Colors" menu item. logic.getMenuItem("View").elementClick(); logic.menuClick({ menuPath: ["View", "Show Colors"], }); } logic.windows.whoseTitle.is('Color').first.elementWaitFor(); } /** * @param {object} obj * @param {number} obj.column * @param {number} obj.row */ function selectColor({ column, row }) { const colorLineIndices = [98, 73, 1, 25, 49]; var colorButtonIndex = colorLineIndices[row] + column - 2; //Select Color sf.ui.app('com.apple.logic10').windows.whoseTitle.is('Color').first.groups.first.groups.first.buttons.allItems[colorButtonIndex].elementClick(); } function main() { //Ensure that the Color Palette is open. ensureColorPaletteIsOpen(); //Select the color selectColor({ column: 1, row: 1, }); } main();
Note: I may have mentioned to you before but we don't have official Logic Pro support for SoundFlow just yet but it is on our roadmap. Hopefully finding & fixing issues like this will help us develop a robust solution.
Rock on!
Alexandre Hirlinger @Alexandre_Hirlinger
Thank you SO much for this, @Kitch. I truly appreciate it. It's working like a charm.
For my workflow, one of the most crucial decks i have is the ability to color tracks quickly and on command. When I'm working in PT its invaluable, so even though you all don't techinically support Logic Pro, this is one of the single most helpful scripts for me when I do need to work in Logic.
Also great to hear that you all will be supporting Logic Pro at some point. I have to bounce back and forth between both DAWs often so I would welcome more functionality with Logic :)
Thanks again!
Kitch Membery @Kitch2021-11-11 21:07:56.247Z
You're welcome @Alexandre_Hirlinger,
I'll be sure to log this difference in behavior so we can address it when it comes time to add logic support.
I might improve this script a little if I get some time this weekend. As I find it very useful myself. Will keep you posted.
Rock on!
Christian Scheuer @chrscheuer2021-11-11 21:52:13.008Z
Great stuff! I bet this is because Logic doesn't update the state (including titles) of the menu items until it's shown. It's possible you can do other things to force it to update the menu items. In PT we sometimes have to force this by using a keyboard shortcut to invoke some command that does nothing, but since it's a PT command having been run, PT will recognize it needs to update the menu state. It's possible something like that can be done for Logic too.
Kitch Membery @Kitch2021-11-11 22:03:18.643Z
Awesome @chrscheuer. I'll log a report later today with a reproducible example so we can have it on file.
Rock on!
Alexandre Hirlinger @Alexandre_Hirlinger
Hey @Kitch! Looks like the update to 10.7 killed this script. I think there were a bunch of GUI updates to logic with 10.7, so I know it's unlikely, but I was curious if there was a way of updating the script to allow for compatibility with 10.7.2. I'm currently working with 10.6.3 but I would love to be able to make the switch at some point. No worries if not! Thanks!
Kitch Membery @Kitch2022-01-06 18:47:25.200Z
I'll see if I can update this over the weekend to work for both versions.
Is it displaying an error message when you run it or does it just not work?
Rock on!
Alexandre Hirlinger @Alexandre_Hirlinger
@Kitch. For me, its just not working, no error message. To be clear, it is working great in 10.6.3!
Kitch Membery @Kitch2022-01-06 19:10:51.151Z
Thanks, this may be a GUI Change. I have 10.7 on my laptop so I should be able to work it out over the weekend :-)
- In reply toKitch⬆:DDarko Obradovic @Darko_Obradovic
Hi, I have the same problem. I use a simple script to solo the first channel in logic pro, and it just doesn't work on version 10.7.2. (does not show any error, just does not work) It has not worked since the first version 10.7 while on 10.6.3 everything works properly. Thanks
Kitch Membery @Kitch2022-01-07 07:23:09.279Z
Thanks for confirming the issue. Hopefully I’ll be able to sort it out over the weekend. :-)
- In reply toAlexandre_Hirlinger⬆:
Kitch Membery @Kitch2022-01-07 10:27:33.487Z
@Alexandre_Hirlinger & @Darko_Obradovic,
Give this script a go, It could use some improvement but should do the trick. It should work in 10.6 versions and 10.7 versions of logic (I've not tested it in LP 10.6 versions yet).
/** @param {String} version */ function useNewScriptVersion(version) { const arrayFromVersion = version.split("."); const zeroPadEnd = (num, places) => String(num).padEnd(places, '0'); const sematicPadedNumber = arrayFromVersion.map(number => zeroPadEnd(number, 3)).join(""); let useNewScriptVersion = false; switch (true) { //Is the version greater version than 10.7 case Number(zeroPadEnd(sematicPadedNumber, 9)) >= 100700000: useNewScriptVersion = true break; } return useNewScriptVersion } function ensureColorPaletteIsOpen() { const logic = sf.ui.app('com.apple.logic10'); //Open Logic Pro X logic.invalidate(); logic.appActivateMainWindow(); //If the Color Palette is not open, Click menu item View -> Show Colors if (!logic.windows.whoseTitle.is('Color').exists) { //Click the "View" menu before clicking the "Show Colors" menu item. logic.getMenuItem("View").elementClick(); logic.menuClick({ menuPath: ["View", "Show Colors"], }); } logic.windows.whoseTitle.is('Color').first.elementWaitFor(); } /** * @param {object} obj * @param {number} obj.column * @param {number} obj.row */ function selectColor({ column, row }) { const logic = sf.ui.app('com.apple.logic10'); const colorWindow = logic.windows.whoseTitle.is('Color').first; const colorWindowButtons = colorWindow.groups.first.groups.first.buttons; const useNewScript = useNewScriptVersion(logic.appVersion); const colorLineIndices = [98, 73, 1, 25, 49]; const columnOffset = useNewScript ? 1 : 2; const colorButtonIndex = colorLineIndices[row] + column - columnOffset; if (useNewScript) { colorWindowButtons.allItems[colorButtonIndex].mouseClickElement(); } else { colorWindowButtons.allItems[colorButtonIndex].elementClick(); } } function main() { //Ensure that the Color Palette is open. ensureColorPaletteIsOpen(); //Select the color selectColor({ column: 1, row: 1, }); } main();
Let me know how it goes.
Rock on!
Alexandre Hirlinger @Alexandre_Hirlinger
So sorry i'm late to respond to this, @Kitch, but it seems to be working like a charm. This script is wild. Thanks so much for this, for real.
Kitch Membery @Kitch2022-01-14 19:14:46.463Z
You're welcome @Alexandre_Hirlinger!