Hi Uwe,
I have got the values before importing the xml and have done all the thingsin one script.
Below I have mentioned my script
main();
with (myDocument.viewPreferences)
{
var myOldXUnits = myDocument.viewPreferences.horizontalMeasurementUnits;
var myOldYUnits = myDocument.viewPreferences.verticalMeasurementUnits;
}//Here tried to get indesign preference values but only getting it always as inches.
//Import xml
function ImportXML(){
if(importOption=="FlOWINTOTEMPLATE")
{
var docPath = app.scriptArgs.get("templateFilePath");
myDocument = app.open(File(docPath),true);
if(myDocument!=null)
{
var rootXMLElement = myDocument.xmlElements.item(0);
ClearProductFamilies(rootXMLElement);
}
}
The structure could be something like that:
main()
function main()
{
var myDocument = app.documents[0];
var myOldXUnits = myDocument.viewPreferences.horizontalMeasurementUnits;
var myOldYUnits = myDocument.viewPreferences.verticalMeasurementUnits;
ImportXML();
myDocument.viewPreferences.horizontalMeasurementUnits = myOldXUnits;
myDocument.viewPreferences.verticalMeasurementUnits = myOldYUnits;
function ImportXML()
{
// Do something reasonable.
// JUST AN EXAMPLE FOR SOMETHING NOT REASONABLE:
myDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.POINTS;
myDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.INCHES;
alert
(
"Measurement Units horizontal / vertical"+"\r"+
myDocument.viewPreferences.horizontalMeasurementUnits.toString()+"\r"+
myDocument.viewPreferences.verticalMeasurementUnits.toString()
);
return
};
}
Regards,
Uwe