well, you could just check for the items you desire, for example gold, as it will respawn each time, so some thing like this?
set %chesttype AAA
set %itemtype BBB_CCC_DDD
repeat
  gosub Check_chest
  wait 50
until #charghost = yes
stop
Sub Check_chest
  finditem %chesttype G_2
  if #findcnt > 0
  {
    set %current_chest #findid
    set #lobjectid %current_chest
    while #contid <> %current_chest
    {
      event macro 17
      wait 20
    }
    finditem %itemtype C_ , %current_chest
    if #findcnt > 0
    {
      display the stuff is found
      pause
      ; You could add looting(check exevent drag, exevent drop on wiki) or whatever here.
    }
  }
return