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

Illustrator changes display units

Community Beginner ,
Dec 24, 2024 Dec 24, 2024

Copy link to clipboard

Copied

How do I use script or code to modify the display units in the current document in Illustrator? My current units are millimeters (or centimeters) but I want to change it to pixels using a script because I have other scripts running in an environment that require fixed units to be pixels. I need to have the document environment in pixels before running it. I checked a lot of information but couldn't find a solution, is there a way to use code completion?

TOPICS
Draw and design , Feature request , Scripting , Tools

Views

145

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 Beginner ,
Dec 24, 2024 Dec 24, 2024

Copy link to clipboard

Copied

That is: "Edit" > "Preferences" > "Units" > "Pixels", the display unit here

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 ,
Dec 24, 2024 Dec 24, 2024

Copy link to clipboard

Copied

I achieved it by opening that menu and keystroke manipulation by AppleScript; for Windows, AutoHotkey is available.

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 Beginner ,
Dec 24, 2024 Dec 24, 2024

Copy link to clipboard

Copied

Sorry, I'm not very familiar with script code. My code is all from ChatGPT. Can this function be accomplished with javascript? Because I need to insert this function into my own script

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 ,
Dec 24, 2024 Dec 24, 2024

Copy link to clipboard

Copied

If JavaScript means ExtendScript, it can only be realized halfway. Changing the units of a document that is already open does not apply to the Illustrator UI.

 

For a perfect solution, use AppleScript/JXA/AutoHotkey, etc.

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
Enthusiast ,
Dec 25, 2024 Dec 25, 2024

Copy link to clipboard

Copied

If you have Windows OS (PC), you can add a piece of VisualBasic code to the JS script that will simulate a keystroke to change the units in the document setup to pixels.

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 Beginner ,
Dec 25, 2024 Dec 25, 2024

Copy link to clipboard

Copied

Sorry, can VisualBasic code be inserted directly into my JavaScript script code? Because I'm not very familiar with these

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
Enthusiast ,
Dec 25, 2024 Dec 25, 2024

Copy link to clipboard

Copied

LATEST

On PC it is possible to create a VBS file and run it while the JS script is running. For Mac OS, this solution does not 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