I have successfully written a script in Rhino4 that contains the following line:
Call Rhino.Command("_Dir F S _Enter")
It flips the directions on a surface and then swap them. This works nicely.
For some reason, this command does not behave in the same way in Rhino5: the S command does not swap the direction but it turns on the grid snap on.
What should be the statement to swap the uv coordinates in Rhino5??
This happens if you start your macro but have no surface(s) preselected. The _SwapUV command line option is only available inside the _Dir command. To avoid that, you can use _Pause after _Dir, so rhino waits for selection and then starts over if you have something selected and ended your selection with Enter (or right mouse button).
_Dir _Pause _SwapUV _Flip _Enter
It still works in one shot if you have one or more surface(s) preselected.