View Single Post
Old 06-27-2020, 03:29 PM   #13
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 2,635
Default

Quote:
Originally Posted by Monomirror View Post
That worked! Thanks so much again!
It works fine unless you also have a textbox (like the filter in Actions window) set to 'Track Manager' too!
I keep forgetting the 'Find' functions in JS API find any window with matching text! So if your worried about that you could check if the window has a child since text boxes don't have children...

Code:
function GetTrackManager()
  local _, list = reaper.JS_Window_ListFind('Track Manager', true)
  for adr in list:gmatch("[^,]+") do
    local hwnd = reaper.JS_Window_HandleFromAddress(adr)
    -- check if window also has a child (ID of 'show all' button)
    if reaper.JS_Window_FindChildByID(hwnd, 0x422) then return hwnd end 
  end
end

local tm = GetTrackManager()
if not tm then
  reaper.Main_OnCommand(40906, 0) -- View: Show track manager window
  tm = GetTrackManager()
end
 
if tm then
  local filter = reaper.JS_Window_FindChildByID(tm, 0x3EF)
  if filter then reaper.JS_Window_SetTitle(filter, '') end
  reaper.JS_Window_Destroy(tm)
end
Edgemeal is offline   Reply With Quote