

    
    local countSelTrack = reaper.CountSelectedTracks(0);
    if countSelTrack == 0 then  return end;

    
    local Tr;
    local LastTouchedTrack = reaper.GetLastTouchedTrack();
    if LastTouchedTrack and reaper.GetMediaTrackInfo_Value(LastTouchedTrack,"I_SELECTED")==1 then;
        Tr = LastTouchedTrack else Tr = reaper.GetSelectedTrack(0,0);
    end;
    count_FX = reaper.TrackFX_GetCount(LastTouchedTrack)    
if    count_FX == 0 then return end
    local retval,str = reaper.GetTrackStateChunk(Tr,"",false);
    local idxSelFx = tonumber(string.match(str,"LASTSEL (%d+)"));
idxSelFx1 = idxSelFx+1 
			retval, fx_name = reaper.TrackFX_GetFXName(LastTouchedTrack , idxSelFx, "")
            if fx_name  == "" then fx_name = "No fx" end;
			retval, presetname = reaper.TrackFX_GetPreset(LastTouchedTrack, idxSelFx, "")
            if presetname == "" then presetname = "No preset" end;
    count_FX = reaper.TrackFX_GetCount(LastTouchedTrack)    

 reaper.GetSetMediaTrackInfo_String(LastTouchedTrack, "P_NAME",fx_name  .. " " .. idxSelFx1 .. " of " .. count_FX .. " " .. presetname,    true)
