How to correctly change the common units of the current document?
Copy link to clipboard
Copied
To change current documet units I use this:
function setUnits() {
var units = 5; //(0 to 6)
app.preferences.setIntegerPreference("rulerType", units);
}
When I say "current documet units" I mean the units of measurement in the transformation window and on the ruler.
However, in order to “see” the new units of measurement, you need to create a new document.
How can I make these changes appear in the current document?
Explore related tutorials & articles
Copy link to clipboard
Copied
Well, wow, amazingly there doesn't seem to be any good way to do this. Incredible! Sorry for bad news. I take it you've seen the workarounds, such as making new document and copy/pasting, or saving uncompressed and editing raw .ai file? Both terrible options when all you want to do is set the document ruler units. SIgh.
- Mark
Copy link to clipboard
Copied
I have lodged a bug report. Please vote to have it fixed. - Mark
Copy link to clipboard
Copied
In the file > document configuration tab (Alt+Ctrl+P) I can change the document's unit of measurement, when I change it there it ignores the default unit settings that are in Edit>preferences>units
This change affects everything, including the transform window and the rulers.
From what I understand, that would be it, right?
Copy link to clipboard
Copied
Un clic droit sur l'une des règles,
Copy link to clipboard
Copied
@christianot40873293 not exactly, we are talking here in the context of script execution
Copy link to clipboard
Copied
Not the easiest way, but for PC users, we can launch the Document Setup window with app.executeMenuCommand("document") and then run a VBScript that emulates keystrokes to select units from the drop down list.

