View Single Post
Old 12-05-2018, 02:29 PM   #1773
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

Quote:
Originally Posted by Breeder View Post
Anyone has a code snippet in Lua/EEL to count visible CC lanes in active MIDI editor? Would be lovely if you could share - thank you
Currently the only child controls inside the piano container (text: "midipianoview", classname: "MIDIPianoWindow") are those CC ComboBoxes. So a quick hack would be to just count the children, you could get their text too.

REQUIRES: js_ReaScriptAPI extension
Tested: REAPER 5.963 & js_ReaScriptAPI v0.951

Code:
function print(str)
  reaper.ShowConsoleMsg(tostring(str) .. "\n")
end

hWnd = reaper.MIDIEditor_GetActive()
if hWnd == nil then return end

child_hWnd = reaper.JS_Window_FindChild(hWnd, "midipianoview", true)
hWnd_array = reaper.new_array({}, 100)
reaper.JS_Window_ArrayAllChild(child_hWnd, hWnd_array)
child_hWnds = hWnd_array.table()

-- display count
print(#child_hWnds)
  
  -- display controls text
for j = 1, #child_hWnds do
  child_hWnds[j] = reaper.JS_Window_HandleFromAddress(child_hWnds[j])
  title = reaper.JS_Window_GetTitle(child_hWnds[j], "", 64)
  print(title)
end

Last edited by Edgemeal; 12-05-2018 at 02:34 PM.
Edgemeal is offline   Reply With Quote