function SHOWINMIXER(show)
reaper.Main_OnCommand(reaper.NamedCommandLookup("_S&M_DUMMY_TGL1"), 0)
reaper.Main_OnCommand(40605,0)
counttracks = reaper.CountTracks(0)
if counttracks == nil then return end
for i = 1, counttracks do
track = reaper.GetTrack(0, i-1)
ftr = reaper.GetParentTrack(track)
ttr = reaper.GetMediaTrackInfo_Value(track, "I_FOLDERDEPTH")
if ftr ~= nil and (ttr == 0 or ttr == -1 or ttr == -3) then
htr = reaper.GetMediaTrackInfo_Value(track, "I_WNDH")
if htr < 24 then
reaper.SetMediaTrackInfo_Value( track, "B_SHOWINMIXER", show)
end
end
end
reaper.TrackList_AdjustWindows(false)
end
function mainloop ()
reaper.defer(mainloop)
end
-- Set ToolBar Button ON
function SetButtonON()
-- msg("YES")
SHOWINMIXER(0)
is_new_value, filename, sec, cmd, mode, resolution, val = reaper.get_action_context()
state = reaper.GetToggleCommandStateEx( sec, cmd )
reaper.SetToggleCommandState( sec, cmd, 1 ) -- Set ON
reaper.RefreshToolbar2( sec, cmd )
end
-- Set ToolBar Button OFF
function SetButtonOFF()
-- msg("NO")
SHOWINMIXER(1)
is_new_value, filename, sec, cmd, mode, resolution, val = reaper.get_action_context()
state = reaper.GetToggleCommandStateEx( sec, cmd )
reaper.SetToggleCommandState( sec, cmd, 0 ) -- Set OFF
reaper.RefreshToolbar2( sec, cmd )
end
----------------------------------------------------------------------------------------------------
SetButtonON() -- функция запуска срипта с "поджигом" кнопки тулбара
mainloop ()
reaper.atexit(SetButtonOFF) -- выход из скрипта с запуском функции выхода с тушением кнопки тулбара