(NOTE: I'm going to type out all the commands for the sake of anyone relatively new to MEL.)
You'll want to look at the scene node called "defaultResolution". You can verify its existence with this command:
Code:
ls -renderResolutions;
You can get a list of all attributes connected to that node via the "listAttr" command:
Code:
listAttr defaultResolution;
The list of attributes for defaultResolution includes entries for width, height, and deviceAspectRatio. To query those attributes:
Code:
getAttr defaultResolution.width;
getAttr defaultResolution.height;
getAttr defaultResolution.deviceAspectRatio;
Of course you can assign those values to variables as needed:
Code:
$width = `getAttr defaultResolution.width`;
$height = `getAttr defaultResolution.height`;
You may also want to check into the default nodes called "defaultRenderGlobals" and "defaultRenderQuality". They may contain additional rendering information that you may need.