it seems that some MCP names are returned with a break line "\n".
(custom names BUS, VSTi and FX)
We have the problem on this forum thread (starts post 19)
Can you reproduce that ?
Thanks for the report, I'll have a look. In the mean time, can you get some kind of project that displays the issue? I don't remember seeing newlines in any layout names when I tested this function.
Hi Breeder. I am the one who stumbled onto this potencial bug when I was going through the ropes of a lua script with the help of X-Raym.
I don't know if a project will be helpful as I can reproduce this in a new project every time.
As you can read in the corresponding Reaper forum thread, I have three layouts named "BUS", "FX" and "VSTi". The same thing happens in all of them. As I use a custom theme, I did the following test for you benefit:
The lua script I'm using right now is this:
-- Get how many tracks there are --
for i=0, track_count-1 do
cur_track=reaper.GetTrack(0,i) -- current track number
mcpLayout, tcpLayout=reaper.BR_GetMediaTrackLayouts(cur_track) -- get layout of current track
-- reaper.ShowConsoleMsg(mcpLayout) shows layouts are retrieved correctly
if mcpLayout=="" then
if mcpLayout=="BUS\n" then
if mcpLayout=="VSTi\n" then
if mcpLayout=="FX\n" then
reaper.UpdateArrange() --refresh to see changes
Since I added the "\n" as per Heda's suggestion, it works great. If I remove it, it does not identify the layout being tested.
Hope this helps. If you require any more info, or if (even I I can reproduce this everytime in a new project) you want me to send you a .rpp, just let me know.
Thanks for taking time to look into this. And thanks for making it availiable in the first place :)
Still can't replicate with Default theme nor one of the Jannes theme I've been using lately.
Can you please upload the theme you're using and the example project for the script you pasted in your last post.
Fixes to ReaScript API for manipulating layouts:
+Fixed #760: fixed BR_GetMediaTrackLayouts broken in certain instances
+BR_GetMediaTrackLayout/BR_SetMediaTrackLayout now use native API so it should make them faster