RulerOrigin - ff6347/extendscript GitHub Wiki
Sometimes it is useful to set some preferences at the beginning of the script. Make sure to save the previous settings and restore them after your script is done. Like this:
var doc = app.activeDocument; // get active doc
var curr_origin = doc.viewPreferences.rulerOrigin; // get active viewPrefrences for the ruler
alert(curr_origin); // inspect them
doc.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN; // now set them to something different
alert(doc.viewPreferences.rulerOrigin); // Inspect them again
doc.viewPreferences.rulerOrigin = curr_origin; // reset to default
The same thing can be done with the lots of other preferences. For example MeasurementUnits.