Copy link to clipboard
Copied
Hey everyone,
I've developed a function. Anyhow, the function on my device (Mac - Catalina) works smothely and when i run it on the designer devoce (Mac - Mohave) It raise an issue. Actully it's simple one, only the fitting differs from mine to his. The items on the document on my device looks good but on his looks very large!
How can i solve the issue? and what could cause the issue? cause we doubled check the setting and we have the same sittings.
Thanks all.
The view preferences probably differ on the other computer. Try this at the start and end of your code:
//Start of script, after you've created the document. This assumes that has a variable called "doc"
var currViewPrefs = doc.viewPreferences.properties;
//or use whatever measurement units you want
doc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.INCHES;
doc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.INCHES;
//end of script to reset preferences back to us
...
Copy link to clipboard
Copied
Does your code set the view preferences measurement units?
Copy link to clipboard
Copied
Nope, it only creates the document and start to set the frames.
Copy link to clipboard
Copied
The view preferences probably differ on the other computer. Try this at the start and end of your code:
//Start of script, after you've created the document. This assumes that has a variable called "doc"
var currViewPrefs = doc.viewPreferences.properties;
//or use whatever measurement units you want
doc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.INCHES;
doc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.INCHES;
//end of script to reset preferences back to user settings
doc.viewPreferences.properties = currViewPrefs;
Copy link to clipboard
Copied
Thanks!
Copy link to clipboard
Copied
As Brian suggests, usually getting and setting the measurement units is the way to go. You can also set the bounds array as strings, and use a specific unit without setting the measurement units:
var mySelection = app.selection[0];
var gm = mySelection.geometricBounds
//bounds set to centimeters
mySelection.geometricBounds = ["1cm", "1cm", "5cm", "5cm"]
//or convert a number to string and then add the dimension unit in = inches
mySelection.geometricBounds = [gm[0], gm[1], (gm[0] + 2.125 ).toString() + " in", (gm[1] + 3.5).toString() + " in"];