Hint:
In your script, when you exit mala and rotate monitor back to horizontal, have your script edit these lines in mala.ini:
SwitchOrientation=0
FlipOrientation=0
You need to play around with it and see if the values need to be 1 or 0. (Depends on how your monitor rotates I think).
If you get it right, mala will always start in horizontal, no matter which orientation it was in when you quit.
Make sure you make a backup copy of your mala.ini just in case it breaks and you need to start over.
Also, I wrote another small app for Mala (called MalaOri), that automatically starts Mala in whatever orientation the monitor is in at the time, but it reads the rotate rig's orientation switches that are connected to the printer port to get that orientation.
Not sure if your script returns the limit switch states to the PC?? (I know you are not using printer port).