vladistone Posted April 10, 2023 Author Share Posted April 10, 2023 On 3/29/2023 at 7:07 AM, Jordi Torres said: I was just demonstrating that it is possible to send out MIDI messages in response to the state of that button. Which messages you send entirely is up to you. would you to demonstrate your code? On 3/27/2023 at 6:20 AM, Jordi Torres said: Here is getting exactly that behavior orchestrated with the help of a single Hammerspoon (Lua) script: To be fair the above does rely on a bit AppleScript plus the SendMIDI command-line tool for sending a MIDI command out a specific MIDI port in response to the values gotten from the Compare button state. The same could be achieved with Keyboard Maestro for those who prefer that tool. Quote Link to comment Share on other sites More sharing options...
vladistone Posted April 11, 2023 Author Share Posted April 11, 2023 On 3/26/2023 at 8:25 AM, des99 said: One of these days I'll dig into the OSC protocol to see what's going on here, because Logic uses this to communicate between Logic and Logic Remote, and I think there's state transmission going on here. It may be that the OSC communication protocol in Logic offers some advantages over the older MCU protocol... Hello @des99 did you dig into OSC protocol? how your result? Quote Link to comment Share on other sites More sharing options...
des99 Posted April 11, 2023 Share Posted April 11, 2023 No, this is not something I'm working on right now. Quote Link to comment Share on other sites More sharing options...
vladistone Posted April 12, 2023 Author Share Posted April 12, 2023 (edited) Finally, I managed to assemble a single applescript for adequate interaction from GUI LPX events (in this example, the "Compare" buttons for smart control) to the MCU controller with SysEx and Note On transmission via Send MIDI. I had to tinker with the problem of quotes that needed to be passed on the terminal command line for the ipMIDI port. maybe not the most elegant solution in applescript coding?! And does anyone have any more interesting ideas on how the LPX Events GUI interacts with the virtually only 3rd party Send MIDI application.knowledge sources on terminal command line via applescript shell script global smartControl_panel -- global variables are available everywhere in the script global compare_button global compare_state global portList global portChoice global gportName set gportName to "ipMIDI Port 1" -- reconstruction of returned message from command line "sendmidi list" set portItem to (do shell script "/usr/local/bin/sendmidi " & "list") set portString to findAndReplaceInText(portItem, " ", ", ") on findAndReplaceInText(theText, theSearchString, theReplacementString) set AppleScript's text item delimiters to theSearchString set theTextItems to every text item of theText set portList to theTextItems set AppleScript's text item delimiters to theReplacementString set theText to theTextItems as string set AppleScript's text item delimiters to "" return theText end findAndReplaceInText -- assigning a MIDI port in the dialog box set portChoice to main() on main() try set portChoice to (choose from list portList with prompt "Which running MIDI-port?" with title "Choose a MIDI-port of destination") if (portChoice is false) then error number -128 try set gportName to "'" & item 1 of portChoice & "'" on error error number -128 end try end try end main -- identifying GUI changes tell application "Logic Pro X" to activate delay 2 tell application "System Events" tell process "Logic Pro X" tell window "task 1 SSL setup 22 jan 2023 - Tracks" -- you will have to specify your own project name to restore the script to work (* the following lines find the smart control panel, by looking for stable features of their respective toolbars. the first looks for the 'Compare' button, the second for the 'Arpeggiator' checkbox. the doubled 'whose' queries look confusing, but basically they say "Find the group whose first group is a toolbar, whose last (slider's/radiobutton's) description is... Once we have those, we can reliably find these area, regardless of whether other groups are opened or closed" *) try set smartControl_panel to first group whose its (first UI element whose role description is "toolbar")'s last checkbox's description is "Arpeggiator" on error -- if smart control panel is not open, so open it by LPX key-command keystroke "b" keystroke "b" delay 2 set smartControl_panel to first group whose its (first UI element whose role description is "toolbar")'s first button's description is "Compare" end try tell smartControl_panel tell first group -- log a list of all the visible UI elements log (get description of every UI element) set compare_button to first UI element whose role description is "button" and description is "Compare" -- log current state of the compare_button log (get enabled of compare_button) set compare_state to compare_button's enabled if compare_state is true then (* tell application "SendMIDI" to activate with raw sysex string by command-line of terminal; or Note_on message which were add at end of that string too, see step after EOX 0xF7 *) do shell script "/usr/local/bin/sendmidi" & " dev " & gportName & " raw hex F0 00 00 66 10 12 00 43 6f 6d 70 61 72 65 F7 90 52 7F" -- do shell script "/usr/local/bin/sendmidi" & " dev " & quoted form of "ipmidi port 6" & " raw hex F0 00 00 66 10 12 00 43 6f 6d 70 61 72 65 F7 90 52 7F" -- another action option - click the Compare_button to toggle its state click compare_button end if end tell end tell end tell end tell end tell Edited April 12, 2023 by vladistone Quote Link to comment Share on other sites More sharing options...
vladistone Posted April 15, 2023 Author Share Posted April 15, 2023 (edited) Hi @Jordi Torres ! Do you know how to get the state value of the GUI object? Edited April 15, 2023 by vladistone Quote Link to comment Share on other sites More sharing options...
Jordi Torres Posted April 15, 2023 Share Posted April 15, 2023 Hi vladistone, 6 hours ago, vladistone said: Do you know how to get the state value of the GUI object? This is the bit of AppleScript I used to get the the on/off value of the Compare button of whichever plugin window has focus: tell application "System Events" tell process "Logic Pro" get value of checkbox "Compare" of window 1 end tell end tell As for the other question you asked via private message: 6 hours ago, vladistone said: is there a trick to recognizing the FX name of the dialog box, in the event that there are more than one of them open on track? i meaning - how to determine the FXnames of track into "windows 1", "windows 2" and so on using applescript? If you mean the plugin name as it appears at the bottom of the plugin window, it doesn't look like it's possible to get that text via the Accessibility API/AppleScript: J. Quote Link to comment Share on other sites More sharing options...
vladistone Posted April 15, 2023 Author Share Posted April 15, 2023 (edited) 41 minutes ago, Jordi Torres said: Hi vladistone, This is the bit of AppleScript I used to get the the on/off value of the Compare button of whichever plugin window has focus: tell application "System Events" tell process "Logic Pro" get value of checkbox "Compare" of window 1 end tell end tell J. Hi @Jordi Torres You did discribed how to get parameter value the dialog windows. but I loocking for the smart control area button, which haven't this "value" (see pic.) Edited April 15, 2023 by vladistone Quote Link to comment Share on other sites More sharing options...
vladistone Posted April 15, 2023 Author Share Posted April 15, 2023 (edited) 38 minutes ago, Jordi Torres said: As for the other question you asked via private message: If you mean the plugin name as it appears at the bottom of the plugin window, it doesn't look like it's possible to get that text via the Accessibility API/AppleScript: J. yes, I ment that text area... so sorry Edited April 15, 2023 by vladistone 1 Quote Link to comment Share on other sites More sharing options...
Jordi Torres Posted April 15, 2023 Share Posted April 15, 2023 20 minutes ago, vladistone said: but I loocking for the smart control area button, which haven't this "value" (see pic.) Oh, the Smart Controls area Compare button. Well, unfortunately it looks like you already have the answer. That button reports no value that can be used, unlike the 0/1 from the Compare button in the plugin windows: J. Quote Link to comment Share on other sites More sharing options...
vladistone Posted April 15, 2023 Author Share Posted April 15, 2023 (edited) 8 minutes ago, Jordi Torres said: Oh, the Smart Controls area Compare button. Well, unfortunately it looks like you already have the answer. That button reports no value that can be used, unlike the 0/1 from the Compare button in the plugin windows: J. That's why I was puzzled in search of a workaround for triggering the value of this control area. Have you any ideas? and according to my version of LPX 10.4 - I have the impression that the change tracking synchronization by compare_buttons between the smart control windows and the window FX / AUi dialog itself with which the smart mapping is created is out of order! Edited April 15, 2023 by vladistone Quote Link to comment Share on other sites More sharing options...
Jordi Torres Posted April 15, 2023 Share Posted April 15, 2023 32 minutes ago, vladistone said: Have you any ideas? Maybe you can make use of KM's Find Image On Screen action as @des99 mentioned at some point. J. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.