• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Can someone please give me a script that changes the ruler metric?

Guest
Jul 13, 2020 Jul 13, 2020

Copy link to clipboard

Copied

I just want to run a script that changes whatever the current ruler is to inches, thank you!

TOPICS
Scripting

Views

749

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Jul 13, 2020 Jul 13, 2020

Copy link to clipboard

Copied

I actually couldn't find a way to do this with a script, but hopefully someone else will know. But just checking that you know you can right-click on the ruler to change units?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 13, 2020 Jul 13, 2020

Copy link to clipboard

Copied

thanks, yeah I know I can righ-click but I'd like a script so that I can work it into a series of tasks in an action. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jul 13, 2020 Jul 13, 2020

Copy link to clipboard

Copied

You can set the units when you create a new document:

 

var preset1 = new DocumentPreset;
preset1.units = RulerUnits.Inches;
var doc1 = app.documents.addDocument("Basic CMYK", preset1);

 

but I don't think you can change them after that.

 

app.executeMenuCommand("unitundoPref") brings up the units dialog box, but you will have to select your units manually.  

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 13, 2020 Jul 13, 2020

Copy link to clipboard

Copied

Hello,

Try following snippet

var units = 3; //(0 to 6)
app.preferences.setIntegerPreference("rulerType", units);

/*Unit list
0 : point
1 : pica
2 : inch
3 : mm
4 : cm
5 : H/Q
6 : px */

 

This will change the ruler units in Units for "General" in Preferences -> Units. So, you can combine this with solution of femkeblanco 

 

Best regards

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 14, 2020 Jul 14, 2020

Copy link to clipboard

Copied

LATEST

Thanks, I did see this from an earlier post but I just can't seem to get it to work. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines