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

Script for Margin TexFrame

New Here ,
Oct 07, 2010 Oct 07, 2010

Is there a way to create a script to increase/decrease left margin and right margin in texframe?

Example:

If I select my textframe (Leftt: 0mm, Right: 0mm) with Tool Selection, and apply the script by shortcut to increase or decrease the margins 1mm to 1mm.

I use milimeters here in Brazil.

Thanks!!

TOPICS
Scripting
1.8K
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 ,
Oct 07, 2010 Oct 07, 2010

Text frames do not actually have 'margins', the text frame border itself is "the margin".

Do you mean to:

1. Increase/decrease the text frame width? (If so: equal on both sides? From one side?)

2. Increase/decrease Text Inset? (Which changes the boundaries of the text inside but leaves the frame size the same)

3. Increase/decrease the active page margins -- the purple guidelines? (Which will do nothing, actually, for any text frames on that page unless "Layout Adjustment" is enabled. Even then, I'm not sure if changing the margins using a script will make "Layout adjust" do its thing.)

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 ,
Oct 07, 2010 Oct 07, 2010

Hmm, sorry. Maybe I couldnt explain.

I mean Increase/Decrease equalon both sides: Right Indent and Left Indent:

Margin.JPG

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
Engaged ,
Oct 07, 2010 Oct 07, 2010

HI Foxy,

Try it.

var confResult = false; myDisplayDialog() if(confResult == true) { if(app.selection[0].constructor.name == "TextFrame") { app.selection[0].paragraphs.everyItem().leftIndent = app.selection[0].paragraphs[0].leftIndent+1; app.selection[0].paragraphs.everyItem().rightIndent = app.selection[0].paragraphs[0].rightIndent+1; } } else { if(app.selection[0].constructor.name == "TextFrame") { app.selection[0].paragraphs.everyItem().leftIndent = app.selection[0].paragraphs[0].leftIndent-1; app.selection[0].paragraphs.everyItem().rightIndent = app.selection[0].paragraphs[0].rightIndent-1; } } function myDisplayDialog() { var myDialog= new Window ('dialog', 'Change Indent'); var buttonInc = myDialog.add('button', undefined, 'Increase'); var buttonDec = myDialog.add('button', undefined, 'Decrease'); buttonInc.onClick = function () {      confResult = true;      myDialog.close(); } buttonDec.onClick = function () {      confResult = false;      myDialog.close(); } myDialog.show(); }

Shonky

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 ,
Oct 08, 2010 Oct 08, 2010

Thank for job!

I´d just wanted to create 2 scripts (one for increase and other for decrease) like this:

Select my Textframe (by selection tool), apply the script "increase" by shortcut (example: Ctrl+Alt+>) and so the text frame

keep with right indent 1mm, left indent 1mm. If I apply it again... right indent 2mm, left indent 2mm; If I apply it again... right indent 3mm, left indent 3mm - on and on.

And finally other script to decrease to 0mm rignt indent and left indent.

I dont need dialog box.

Thanks anyway!

Sorry for my english!

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
Engaged ,
Oct 08, 2010 Oct 08, 2010

Check it.

//Increase Indent script if(app.selection[0].constructor.name == "TextFrame") { app.selection[0].paragraphs.everyItem().leftIndent = app.selection[0].paragraphs[0].leftIndent+1; app.selection[0].paragraphs.everyItem().rightIndent = app.selection[0].paragraphs[0].rightIndent+1; } //Decrease Indent script if(app.selection[0].constructor.name == "TextFrame") { var leftIndent = app.selection[0].paragraphs[0].leftIndent -1; var rightIndent = app.selection[0].paragraphs[0].rightIndent -1; alert (leftIndent) if(leftIndent>0 && rightIndent>0) { app.selection[0].paragraphs.everyItem().leftIndent = app.selection[0].paragraphs[0].leftIndent-1; app.selection[0].paragraphs.everyItem().rightIndent = app.selection[0].paragraphs[0].rightIndent-1; } }

Shonky

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 ,
Oct 09, 2010 Oct 09, 2010
LATEST

Yes!!

Thank you again!

It´s what I needed!

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