Orientation is basically a meaningless concept in PostScript.
Think of it this way: PostScript is device-independent. Orientation is a device-level choice or function (print from this tray, or that tray).
All PostScript cares about is marking things on a page. If the page is 8.5x11 vs 11x8.5, it doesn't care. They are just two different sizes, the concept of "orientation" doesn't come into play.
You can look for a DSC (Document Structuring Convention) comment, %%Orientation. Of course it won't be there in every case, or even the majority of cases.
This is a comment meant to be read by a Document Manager. This is a term Adobe uses for hardware or software that "pre-processes" the PostScript, reading DSC to setup parameters for the job prior to ripping.
Related DSC comments that might be helpful are:
%%PageOrientation
%%BoundingBox
%%PageBoundingBox
You can also look for setpagedevice dictionaries that contain the /PageSize entry, and try to interpret "orientation" from that.
Since you're posting in a PostScript programming forum, can I assume that when you mean "conditional expression" and "use this form", that you are referring to PostScript language operators, booleans, and form dictionaries?
In this case, and I'm working in the absence of any detail here, if you know how to programmatically change the Form Dictionary, you can certainly change the pagesize and rotation as well.
Let me know some more details about the job at hand, and I should be able to help more.
Thomas D. Greer