Highlighted

Justify text in a frame for a specific master page | script?

New Here ,
May 05, 2020

Copy link to clipboard

Copied

I am wondering if it is possible to write/have a script that can justify text in a text frame for a specific master page.

From time to time I have to format manuscripts, that are usually straight forward in their structure. That means I have a front- and a backmatter (Acknowledgments, Dedication, and whatnot) and in between there is the actual story. Usually I apply one master page (A) to the front- and backmatter (e.g. i-vi and vii-xii) and a second one (B) to the actual story. (The second one (B) has a footer and header; for the title of the book and the author’s name (header) and the pagination (footer). The first one has nothing on it.)

Once I have switched on the paragraph control I am going through the file to look for pages with (one or) two “empty lines” at the end of each page and try to change the settings in other paragraphs on this pages to avoid it – at least for two empty lines. After that I go to Find/Replace – Objects and change the adjustments from “top” to “justify”. Because I can’t pick specific pages (or a master page) the whole document is now justified. So, I go back and change it back to “top” where it is necessary.

I think a script could do that job too, but I am not sure.

It should be run for an active document and it would be cool to pick the master page(s) I would like to have those changes.

The one thing I am not sure is, if it is possible to exclude pages with a page break. Why that? The last page of a chapter has usually less lines. Sometimes it’s only half a page, or a quarter, or three-quarter.

 

All in all a script should do that:

active.document

versionCS6

Change text adjustment in a frame from “top” to “justify”, but only on master page(s).

Exclude page with a page break.

 

Before I dig deeper into scripting I was wondering if you think that is even possible, especially because I still work with CS6.

 

Thank you for your time!

Dan

Most Valuable Participant
Correct answer by _Jongware_ | Most Valuable Participant

Have you considered using an object style for your text alignment?

You can make two object styles: one 'regular', the other 'vertically justified'; bind two censecutive shortcut keys to these styles for almost-immediate access. Then make sure all of your frames have the most-preferred style (set them in your master pages, or apply them using Find/Change), and walk through the document once, hot-keying the ones that should be changed.

Topics

Scripting

Views

445

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Justify text in a frame for a specific master page | script?

New Here ,
May 05, 2020

Copy link to clipboard

Copied

I am wondering if it is possible to write/have a script that can justify text in a text frame for a specific master page.

From time to time I have to format manuscripts, that are usually straight forward in their structure. That means I have a front- and a backmatter (Acknowledgments, Dedication, and whatnot) and in between there is the actual story. Usually I apply one master page (A) to the front- and backmatter (e.g. i-vi and vii-xii) and a second one (B) to the actual story. (The second one (B) has a footer and header; for the title of the book and the author’s name (header) and the pagination (footer). The first one has nothing on it.)

Once I have switched on the paragraph control I am going through the file to look for pages with (one or) two “empty lines” at the end of each page and try to change the settings in other paragraphs on this pages to avoid it – at least for two empty lines. After that I go to Find/Replace – Objects and change the adjustments from “top” to “justify”. Because I can’t pick specific pages (or a master page) the whole document is now justified. So, I go back and change it back to “top” where it is necessary.

I think a script could do that job too, but I am not sure.

It should be run for an active document and it would be cool to pick the master page(s) I would like to have those changes.

The one thing I am not sure is, if it is possible to exclude pages with a page break. Why that? The last page of a chapter has usually less lines. Sometimes it’s only half a page, or a quarter, or three-quarter.

 

All in all a script should do that:

active.document

versionCS6

Change text adjustment in a frame from “top” to “justify”, but only on master page(s).

Exclude page with a page break.

 

Before I dig deeper into scripting I was wondering if you think that is even possible, especially because I still work with CS6.

 

Thank you for your time!

Dan

Most Valuable Participant
Correct answer by _Jongware_ | Most Valuable Participant

Have you considered using an object style for your text alignment?

You can make two object styles: one 'regular', the other 'vertically justified'; bind two censecutive shortcut keys to these styles for almost-immediate access. Then make sure all of your frames have the most-preferred style (set them in your master pages, or apply them using Find/Change), and walk through the document once, hot-keying the ones that should be changed.

Topics

Scripting

Views

446

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Most Valuable Participant ,
May 06, 2020

Copy link to clipboard

Copied

Have you considered using an object style for your text alignment?

You can make two object styles: one 'regular', the other 'vertically justified'; bind two censecutive shortcut keys to these styles for almost-immediate access. Then make sure all of your frames have the most-preferred style (set them in your master pages, or apply them using Find/Change), and walk through the document once, hot-keying the ones that should be changed.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
DanHu LATEST
New Here ,
May 07, 2020

Copy link to clipboard

Copied

Thank you for the reply, _Jongware_!

I will have a look at it.

Thanks!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...