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

setting margins

Community Expert ,
Jul 16, 2008 Jul 16, 2008
Ive only rather recently started using Scripts (almost) seriously and with the documentation and the helpful forum-contributors for Illustrator and Photoshop gotten some results.
But the Indesign-documentation seems a bit less accommodating and Ive found less sample Scripts online, so I hope You forgive if I raise a terribly basic question here:
How does one set the margins for a new document with JavaScript?

Any suggestions appreciated
pfaffenbichler
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
Community Expert ,
Jul 17, 2008 Jul 17, 2008
app.activeDocument.marginPreferences.top = "25mm";
...bottom, left, right

Peter
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 ,
Jul 17, 2008 Jul 17, 2008
Both Document and Page objects have a property MarginPreferences. There you can find what you need: top, bottom, left, & right, and some column stuff.

Odd -- I tried

doc = app.documents.add();

doc.marginPreferences.top = "1cm";


but that didn't change the new page on screen OR the document margin settings. However,

doc = app.documents.add();

doc.pages[0].marginPreferences.top = "1cm";
doc.pages[0].marginPreferences.left = "1pt";
doc.pages[0].marginPreferences.bottom = "1in";
doc.pages[0].marginPreferences.left = "1ag";


works fine for a single page.
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 ,
Jul 17, 2008 Jul 17, 2008
First of all thanks for the replies!
Peter, I didnt get quite the result I wanted with those lines as they seem to affect only the non-template pages  but I guess my question was imprecise.
Jongware, Your thing works great for my purposes as I only want to customize the Image Catalogue-Script and that seems to use the margins of the first page as basis for all pages.

Thanks a lot
pfaffenbichler
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 ,
Jul 17, 2008 Jul 17, 2008
>Odd

True, forgot about that one. When you retrieve margins you have to do the same. doc.marginPreferences.top gives you the top margin of the application, doc.pages[0].marginPreferences.top that of the document.

Peter
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 ,
Jul 19, 2008 Jul 19, 2008
So can one edit the Margins of the Master Pages via a JavaSript at all?
Because when I try

myDocument.masterSpreads[0].marginPreferences.top = "0mm";
etc.

I get the reply that the Object doesnt support »marginPreferences«.
I hope Im not using wrong terms, but Im using a non-english version of Indesign.
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 ,
Jul 19, 2008 Jul 19, 2008
Spreads don't have margin preferences -- the pages on the spread do.

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
Community Expert ,
Jul 19, 2008 Jul 19, 2008
Thanks a lot, I still dont get the Object Model obviously.

Have a nice weekend
pfaffenbichler
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
Contributor ,
Jul 19, 2008 Jul 19, 2008
To go back to your original post. There are plenty of scripts to download. In the script examples that are shipped with InDesign CS3 there is one called PageMargins.jsx.

Try to get them. They will help you in many cases.

Ralf
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 ,
Jul 19, 2008 Jul 19, 2008
Ralf, I hope my original post didnt come of as reproachful or something!
I just havent found as many Scripts for Indesign as for Photoshop or Illustrator, of course that doesnt mean there arent sources just as good as for these other programmes.
(The documentation-pdfs that ship with AI and PSD I do find more elucidating though than whats provided with INDD.)

Anyway I am grateful for the generousness with which the contributors in these fora help the less knowledgeable.
pfaffenbichler
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 ,
Aug 01, 2008 Aug 01, 2008
LATEST
Ralf, some belated humble pie for me ... I had simply missed the documentation on the DVD because it wasnt installed with the program.
So Ive done the Indesign-people an injustice, my bad.
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