Try chunked version for moving FX:
Code:
fxname = 'ReaEQ'
windX = 550
windY = 10
-- InsertFX / Move focused Track FX
------------------------------------------------------------------------------------------------------
function literalize(str) -- http://stackoverflow.com/questions/1745448/lua-plain-string-gsub
if str then return str:gsub("[%(%)%.%%%+%-%*%?%[%]%^%$]", function(c) return "%" .. c end) end
end
-------------------------------------------------
function msg(s) reaper.ShowConsoleMsg(s) end
function main(track, fxnumber, windX, windY)
if not track or not fxnumber then return end
fx_guid = literalize(reaper.TrackFX_GetFXGUID( track, fxnumber ))
_, chunk = reaper.GetTrackStateChunk( track, '' )
fx_chunk = chunk:match('BYPASS.-'..fx_guid)
FLOAT_chunk = fx_chunk:match('FLOAT %d+ %d+ %d+ %d+\n')
if FLOAT_chunk then
x,y,w,h = FLOAT_chunk:match('FLOAT (%d+) (%d+) (%d+) (%d+)\n')
if w == 0 then w = 500 h = 400 end
FLOAT_chunk_mod = 'FLOAT '..windX..' '..windY..' '..w..' '..h..'\n'
fx_chunk_mod = fx_chunk:gsub(literalize(FLOAT_chunk),FLOAT_chunk_mod)
else
FLOATPOS_chunk = fx_chunk:match('FLOATPOS %d+ %d+ %d+ %d+\n')
fx_chunk_mod = fx_chunk:gsub(literalize(FLOATPOS_chunk),'')
fx_chunk_mod = fx_chunk..'\n'..'FLOAT '..windX..' '..windY..' 500 400 \n'
end
chunk_out = chunk:gsub(literalize(fx_chunk),fx_chunk_mod)
reaper.SetTrackStateChunk( track, chunk_out )
--msg(chunk_out)
end
for i = 1, reaper.CountSelectedTracks(0) do
local track = reaper.GetSelectedTrack(0,i-1)
local fxnumber = reaper.TrackFX_AddByName( track, fxname, false, 1 )
main(track, fxnumber, windX, windY)
reaper.TrackFX_Show( track, fxnumber, 3 )
end