  reaper.Undo_BeginBlock()
  for key in pairs(reaper) do _G[key]=reaper[key]  end 
local val =0.01

  
  item = reaper.GetSelectedMediaItem(0,0)
  if item == nil then return end
    take = reaper.GetActiveTake(item)
    if take == nil then return end 
    local tkpan = GetMediaItemTakeInfo_Value( take, 'D_PAN' )
if tkpan <= 1.0 then
tkpan_out = tkpan + val
    SetMediaItemTakeInfo_Value( take, 'D_PAN', tkpan_out)
    UpdateItemInProject( item )

end
if tkpan <= 1.0 then

tkpan_out2 = tkpan_out*100
else
tkpan_out2 = "100 "
end
  reaper.Undo_EndBlock("Pan take to right", -1)
reaper.osara_outputMessage(tkpan_out2)