Try this. It will leave the AV queue for any toons that are still queued or have had their queue pop. It will do nothing if they are inside AV (the API does leaving a BG and dropping queue with same function).

NOTE: I haven't run this to confirm it works, but it should be close to something that does.

PHP Code:
/script
for i=1,MAX_BATTLEFIELD_QUEUES do
 
local s,n=GetBattlefieldStatus(i)
 if (
n=="Alterac Valley") and (s=="queued" or s=="confirm"then
  AcceptBattlefieldPort
(i,0)
  break
 
end
end