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

A Zoom_to script

Community Expert ,
Mar 31, 2011 Mar 31, 2011

With a lot of help from Jongware, here's a little script to change the view zoom level for an AI document window.

////////////

var ZF = prompt ("Enter the zoom factor you wish to use, 1.00 = 100%", 1.00, "Zoom to New Level");

if ( app.documents.length > 0 ) {
app.documents[0].views[0].zoom = ZF;
}

////////////////

TOPICS
Scripting
2.9K
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

correct answers 1 Correct answer

Community Expert , Apr 01, 2011 Apr 01, 2011

Larry G. Schneider wrote:

With a lot of help from Jongware, here's a little script to change the view zoom level for an AI document window. ...

If you know the difference between your own screen and Illustrator's "100%", you can even get an 'actual' size! (Or a percentage thereof.)

Draw a rectangle and make it an easy, rounded size -- not something like 322.5367pt x 574.322pt, but, for example 5" x 5". Then set the scale to 100% according to Illustrator. Hold a ruler next to the object -- one in yo

...
Translate
Adobe
Community Expert ,
Mar 31, 2011 Mar 31, 2011

well done Larry

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
Community Expert ,
Apr 01, 2011 Apr 01, 2011

Larry G. Schneider wrote:

With a lot of help from Jongware, here's a little script to change the view zoom level for an AI document window. ...

If you know the difference between your own screen and Illustrator's "100%", you can even get an 'actual' size! (Or a percentage thereof.)

Draw a rectangle and make it an easy, rounded size -- not something like 322.5367pt x 574.322pt, but, for example 5" x 5". Then set the scale to 100% according to Illustrator. Hold a ruler next to the object -- one in your hand, of course, not the one on your screen! -- and measure the actual size of the 5" object. That might give you, for example, a distance of 3.85". Now fill in your values in the next script, and hey! actual scaling is enabled!

Note: the LEFT value of the scale is what you entered in Illustrator, the RIGHT value is what you actually measured. Both should be in the same measurement units, obviously.

(Now isn't it a shame Illustrator does not allow you to add a hotkey to your own scripts?)

var scale = 5/3.85; // FILL IN *YOUR OWN* VALUES!

if ( app.documents.length > 0 )
{
var ZF = prompt ("Enter the zoom factor you wish to use, in percents", 100, "Zoom to New Level");
if (ZF != undefined)
  app.documents[0].views[0].zoom = (ZF * scale)/100;
}

This teeny tiny script contains 3 more improvements over Larry's:

1. It doesn't show the dialog if there are no documents open (switched the prompt and the Document Open test.)

2. It doesn't give an error if you cancel the dialog (tested for "undefined" return result)

3. You can enter a percentage as usual (divided the entered value by 100).

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
Guide ,
Apr 01, 2011 Apr 01, 2011

If app.redraw() actually worked as you would want it to… you could possibly take an on screen tour of your art in some animated fashion…

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
Community Expert ,
Apr 01, 2011 Apr 01, 2011

Thanks for the improvements. I keep learning from the best.

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
Community Expert ,
Apr 01, 2011 Apr 01, 2011

that is Jongware/Mark in no particular order

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
New Here ,
Aug 12, 2014 Aug 12, 2014
LATEST

Do you think I can apply this technique to the slider image of my 2 sites:

I would really appreciate some help.

Builders Cambridge

or

Landscaping Cambridge

Sorry but I am kind of a newbie

Regards

Alessandro

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