If you have FM 13, there's a trigger for that. If you have 12, there's a few sort-of work arounds that involve making imaginative use of the anchors in layout mode, and/or using an on timer script to almost constantly check for orientation.
I don't see how Get(WindowOrientation) would help here, because what I need is for the particular layout to go to:
Print Setup-> Orientation: Landscape (if orientation is to be landscape) and
Print Setup-> orientation: Portrait (if orientation is to be portrait)
I need to SET orientation, not GET.
Add print set up script step to your script and in your script select landscape or portrait