@AlexLazer,
PHP:
local FxChain = [[C:\Users\Users\bla\reaper\FXChains\bla.RfxChain]];
-------------------------------------------------------
local function no_undo()reaper.defer(function()end)end;
-------------------------------------------------------
local CountSelTrack2 = reaper.CountSelectedTracks2(0,true);
if CountSelTrack2 == 0 then no_undo()return end;
-------------
local file = io.open(FxChain,'r')
if not file then reaper.MB('No FxChain (((','Woops',0)no_undo()return end;
local textChain = file:read("a");
file:close();
-------------
reaper.PreventUIRefresh(1);
reaper.Undo_BeginBlock();
for i = 1,CountSelTrack2 do;
local SelTrack = reaper.GetSelectedTrack2(0,i-1,true);
local retval,str = reaper.GetTrackStateChunk(SelTrack,'',false);
local CheckChain = str:match('<FXCHAIN_REC');
local str2 = nil;
if CheckChain then;
str2 = str:gsub('<FXCHAIN_REC','<FXCHAIN_REC\n'..textChain..'\n');
else;
str2 = str:gsub('^%s-<TRACK','<TRACK\n<FXCHAIN_REC\n'..textChain..'\n>\n');
end;
if str2 and str2 ~= str then;
reaper.SetTrackStateChunk(SelTrack,str2,false);
end;
end;
reaper.PreventUIRefresh(-1);
reaper.Undo_EndBlock("Add Input FX Selected track",-1);