Skip to main content
Inspiring
Oct 11, 2024 9:25 AM UTC
Question

How to correctly change the common units of the current document?

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?

This topic is closed to new replies. Start a new post to keep the conversation going.

6 replies

Sergey Osokin
Inspiring
Oct 14, 2024 10:37 AM UTC

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.

Translate
christianot40873293
Community Expert
Community Expert
Oct 11, 2024 10:11 AM UTC

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?

Translate
renél80416020
Inspiring
Oct 11, 2024 10:49 AM UTC

Un clic droit sur l'une des règles,

 

Translate
m1b
Community Expert
Community Expert
Oct 11, 2024 9:45 AM UTC

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

Translate
m1b
Community Expert
Community Expert
Oct 11, 2024 11:47 AM UTC

I have lodged a bug report. Please vote to have it fixed. - Mark

Translate