-- if selected track is a folder then -- collapse folder -- if not then -- toggle…
- User
-- if selected track is a folder then -- collapse folder -- if not then -- toggle between A and B
-- RYKORD - CHANGE TRACK SIZE / COLLAPSE EXPAND FOLDERS --
function main() for i = 0, reaper.CountSelectedTracks(0) - 1 do local selected_track = reaper.GetSelectedTrack(0, i) if reaper.GetMediaTrackInfo_Value(selected_track, "I_FOLDERDEPTH") == 1 then reaper.Main_OnCommand(1042, 0) reaper.SetTrackSelected(selected_track, false) else reaper.SetMediaTrackInfo_Value(selected_track, "I_TCPH", 110) end end reaper.UpdateArrange() end main()why isn't the script changing the track's tcp size? reaper lua script. give me the shortest answer possible
- Assistant
The script is missing the part where it toggles between A and B states for size change. Add a condition to switch between two sizes (e.g.,
A_heightandB_height) and a means to keep track of the current state per track. Currently, it only attempts to set a fixed size (110) without toggling. - User
but it doesn't change to that fixed size
- Assistant
The reason the script does not change the track's TCP size is likely because the command to set the track's height (I_TCPH) requires a value for "height", and you need to ensure the TCP layout supports manual height adjustment. Additionally, make sure your script is actually reaching and executing the
SetMediaTrackInfo_Valueline correctly. If the conditions for changing track height are not met (e.g., the selected track is a folder), the track height won't change. Check your setup and ensure that the tracks are not in a minimal height state or a state that prevents height adjustments. - User
why can i zoom vertically but can't adjust the tcp height manually
- Assistant
If you can zoom tracks vertically using Reaper's zoom functions but can't manually adjust the track control panel (TCP) height through a script (or even possibly through the GUI), there could be several reasons:
-
Layout Restrictions: Some track layouts in Reaper are designed to have a fixed height and do not allow for manual resizing. Make sure you're using a track layout that supports height adjustment.
-
Scripting Issues: In your script, setting
I_TCPHto adjust height might not work if:
-
- User
reaper api function to change the tcp height
- Assistant
To change the Track Control Panel (TCP) height for a track in Reaper through scripting, you use the
SetMediaTrackInfo_Valuefunction provided by the ReaScript API. The specific value you want to set is"I_TCPH"for the height in pixels.Here's an example of how you could set the TCP height of the first selected track in Reaper to 100 pixels using Lua:
function setTrackHeight(height) -- Get the first selected track in the project local track = reaper.GetSelectedTrack(0, 0) if track then -- Set the track's TCP height reaper.SetMediaTrackInfo_Value(track, "I_TCPH", height) reaper.TrackList_AdjustWindows(false) -- false to not minimize others reaper.UpdateArrange() end end setTrackHeight(100) - User
that script is not changing the height of the tcp
- Assistant
- User
-- if selected track is a folder then -- collapse folder -- if not then -- toggle between A and B
-- RYKORD - Collapse or Expand Track & Folders -- function main()
for i = 0, reaper.CountSelectedTracks(0) - 1 do local selected_track = reaper.GetSelectedTrack(0, i) if reaper.GetMediaTrackInfo_Value(selected_track, "I_FOLDERDEPTH") == 1 then reaper.Main_OnCommand(1042, 0) else if reaper.GetMediaTrackInfo_Value(selected_track, "I_TCPH") ~= 23 then reaper.SetMediaTrackInfo_Value(selected_track, "I_HEIGHTOVERRIDE", 20) --reaper.SetTrackSelected(selected_track, false) --reaper.SetTrackSelected(selected_track, true) else reaper.SetMediaTrackInfo_Value(selected_track, "I_HEIGHTOVERRIDE", 110) --reaper.SetTrackSelected(selected_track, false) --reaper.SetTrackSelected(selected_track, true) end end endend
main()
why do the tracks only change tcp height when i deselect them?
- Assistant
The behavior you're observing, where the TCP height change only becomes visually apparent after deselecting and reselecting tracks, likely stems from how REAPER updates its graphical user interface (GUI) in response to changes made through scripting.