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

[ILL CS2]How to set the ruler to the measurement unit that we want?

New Here ,
Aug 29, 2008 Aug 29, 2008
Hi,

Im using javascript for Illustrator CS2.
How can i set the ruler to the meaurement unit that i want?

code snippet pls

Regards
myria
TOPICS
Scripting
1.3K
Translate
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
Guest
Sep 08, 2008 Sep 08, 2008
I'm using CS3 and would like to know this too.

I don't see much written about this in this forum.

Is this some sort of bug which prevents the change of the ruler unit via scripting??

Regards
Norbert
Translate
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
LEGEND ,
Sep 09, 2008 Sep 09, 2008
The RulerUnits property of the document object is read-only.

JET
Translate
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
Sep 09, 2008 Sep 09, 2008
Hi James,

If the RulerUnits property of the document object is read-only, how then can it be cahnged via Illustrators UI?

Regards
Norbert
Translate
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
LEGEND ,
Sep 10, 2008 Sep 10, 2008
Not everything that can be done in the UI can be done in the scripting model. (Nor vice-versa.) Far from it.

For just one example: In the UI, you can give a single path multiple strokes and fills. Can't do that in the scripting model.

JET
Translate
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
Sep 10, 2008 Sep 10, 2008
Thats odd JET,

Seems like Adobe have lost interest in Illustrator. In Indesign you can script all of whats possible in the UI and more.

In Corel Draw as well, you can script all of what the UI can achieve, and more.

Regards
Norbert
Translate
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
LEGEND ,
Sep 12, 2008 Sep 12, 2008
> In Indesign you can script all of whats possible in the UI

Do you know that, in fact, to be true? Is that actually stated somewhere in the documentation that you can point me to?

(I haven't had as much opportunity as I would like in scripting InD; have focused on AI.)

JET
Translate
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
Participant ,
Sep 12, 2008 Sep 12, 2008
It's not quite true to say that you can script anything in the UI in InDesign, but it's darn close, and there are things that can be done in scripts that can't be done in the UI.

Examples:

You can't set Script Attachability by script -- if you could, it would rather make a nonsense of the concept of having such a preference.

In a script, you can "paste into" a shape more than one other object while in the UI you are limited to one object (you don't actually use "paste into" to achieve this in a script; rather, you add to the object collections owned by the shape object).

Dave
Translate
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
LEGEND ,
Sep 13, 2008 Sep 13, 2008
> ...and there are things that can be done in scripts that can't be done in the UI.

I'd consider that a matter of course. Otherwise, scripting would be little more than a mere macro recorder/playback feature (which Illustrator has in its Actions feature).

It's those scripting things that can't be done in the UI that interest me most in a drawing program. Examples:

-Call for an ellipse aspect ratio in terms of a single "angle" value (with which anyone who has ever used drafting templates is familiar), instead of by the tedious height and width dimensions.

-Randomly distribute instances of one object within the bounds of another.

-Programmatically draw faux "fractal" constructs like tree branching or lightning.

-Create a set of sequentially-numbered textframe objects (as for callouts in a technical drawing).

-Create a tedious geometric construct like a wireframe "sphere" with user-defined numbers of latitude/longitude lines, and at any user-defined tilt angle. (The potential for other similar constructs via scripting is no doubt huge, and has yet to be explored.)

And so on.

In fact, in a drawing program, I would much prefer the scripting model development to enable things that can't be done in the UI than focus on mere automated playback of UI features. For example, a "collision detection" or "overlap" function could be employed for many useful scripted possibilities, if pathItems had some kind of "region" property that would let you distinguish "inside" from "outside" a path.

> It's not quite true to say that you can script anything in the UI in InDesign, but it's darn close...

It would be darn close in AI, too, if but for two things:

First, AI's bug which has, for at least three versions now, prevented Actions from calling scripts. It can be done for the duration of a worksession, but the Action (macro) "forgets" which script is to be called between launches of the program.

Second, the missing script method to launch an Action, and then return to the script.

Fix the first and add the second, and one would also be able to say that AI's scripting is darn close to being able to do whatever the UI can, too....

...with the exception of a few things that I suspect have more to do with the (goofy) way that AI is built; some foundational things in AI are archaic throwbacks for which competing programs found better treatments decades ago. (I say 'I suspect' because I am only a rank beginner of a programmer; corrections from anyone who actually knows better are quite welcome.) Examples:

Illustrator still doesn't provide user-defined ruler scales. It seems arcaically married to its underlying 1/72" grid, and everything in the program is tyrannically referenced to that.

Certain fundamental things that should be document-specific are instead stashed away in preferences. SmartGuides settings, for example, should clearly be document-specific, not app-level, settings. I've long suspected that kind of thing might be related to the scripting model's inability to change some "document specific" things like Artboard size and ruler units.

Certain "features" of Illustrator appear to be actually implemented as clumsy workarounds or "cheats", as opposed to proper and straightforward programming. I wonder if that's what gives rise to some seemingly bizarre aspects of the scripting model, like its apparent confusion between Global Swatches (a poorly-conceived and poorly-executed aspect of AI in itself) and Spot Colors.

I also take the continued ommission of certain downright embarassingly absent bread & butter features long commonplace in any decent drawing program as root causes of limitations of the scripting model. For example, it should be suspected by any experienced vector illustrator who is even moderately observant that there must be something seriously awry in AI's underpinnings to explain its still not including a straightforward, no-nonsense path-cutting/shape-trimming functionality that properly handles strokes and fills of the same path(s).

So I could be wrong, but I suspect some of the apparent "incompleteness" of AI's scripting model may have more to do with AI's archaic underpinnings.

JET
Translate
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
Sep 17, 2008 Sep 17, 2008
Hi Dave,

Whats Script Attachability??

Can it be done via the user interface??

Regards
Norbert
Translate
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
Sep 17, 2008 Sep 17, 2008
LATEST
Oops!!

Sorry Dave, I was presuming that we would be listing out what can be done in the UI that cannot be done via scripts.

My fault. Sorry!

Cheers
Norbert
Translate
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