I haven't tested it, but this is what it in theory should look like.
Code:
/run local v,m,f=C_VideoOptions,GetCVar("gxMonitor"),GetCVar("gxFullscreen")~="0";local t=v.GetGameWindowSizes(m,f);if #t>1 then v.SetSetGameWindowSize(t[t[2]:IsEqualTo(v.GetCurrentGameWindowSize(m,f)) and 1 or 2]:GetXY());end
It approaches the macro character limit at 227/256. If there's only one resolution option, it does nothing. If there's more than one, it looks at the top two and should alternate between them. However, in windowed mode, the current resolution can equal neither of them. It'll default to the top one in this case.