local r = reaper; local function nothing() end; local function bla() r.defer(nothing) end

local tracks = r.CountTracks()
    if tracks == 0 then  return end;
retval, preset = r.GetUserInputs("enter the name of track", 1, "", "")
name = preset
if not tracks == 0 then bla() return end

r.Undo_BeginBlock() r.PreventUIRefresh(1)

r.Main_OnCommand(40297,0) -- unselect all tracks


for i = 0, tracks-1 do
  local tr = r.GetTrack(0, i)
  local _, tr_name = r.GetSetMediaTrackInfo_String(tr, 'P_NAME', '', 0)
  if tr_name  == name then r.SetTrackSelected(tr, 1) end
end
r.PreventUIRefresh(-1) r.Undo_EndBlock('Select track', -1)

local timer2 =  reaper.NamedCommandLookup("_OSARA_REPORTSEL")
		reaper.Main_OnCommand(timer2, 0)

