View Single Post
Old 02-01-2019, 08:14 AM   #7
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
Default

Quote:
Originally Posted by Vagelis View Post
I'd like to ask if it's possible to show/toggle the fx browser even when there's no fx on the item take.
Only way I know off hand would be to use js_ReaScriptAPI extension to find those 'add fx to item' windows and close them, so maybe something like this,..

Code:
if not reaper.APIExists("JS_Window_Find") then
  reaper.MB("js_ReaScriptAPI extension is required for this script.", "Missing API", 0)
  return
end

local item = reaper.GetSelectedMediaItem(0, 0) -- Get 1st selected item

if item then
  local take = reaper.GetActiveTake(item)
  local index = reaper.TakeFX_GetChainVisible(take)
  if index >= 0 then -- take fx chain is visible
    reaper.TakeFX_Show(take, index, 0) -- showflag=0 for hidechain, =1 for show chain(index valid), =2 for hide floating window(index valid), =3 for show floating window (index valid)
  else  -- close 'fx item' windows if found
    local hwnd1 = reaper.JS_Window_Find(reaper.JS_Localize("Add FX to: Item", "common"), false)
    local hwnd2 = reaper.JS_Window_Find(reaper.JS_Localize("FX: Item", "common"), false)
    if hwnd1 or hwnd2 then
      if hwnd1 then reaper.JS_WindowMessage_Post(hwnd1, "WM_CLOSE", 0,0,0,0) end
      if hwnd2 then reaper.JS_WindowMessage_Post(hwnd2, "WM_CLOSE", 0,0,0,0) end
    else -- show fx chain/fx add browser
      reaper.Main_OnCommand(40638, 0) -- Item: Show FX chain for item take
    end 
  end
end

Last edited by Edgemeal; 02-01-2019 at 09:26 AM. Reason: add comments
Edgemeal is offline   Reply With Quote