Copy link to clipboard
Copied
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!!
Copy link to clipboard
Copied
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.)
Copy link to clipboard
Copied
Hmm, sorry. Maybe I couldnt explain.
I mean Increase/Decrease equalon both sides: Right Indent and Left Indent:
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Yes!!
Thank you again!
It´s what I needed!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now