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

Event listener to check border

Participant ,
Jan 04, 2024 Jan 04, 2024

Copy link to clipboard

Copied

Hi,

my object is "relative spin" and.... 
Is this possible? When you move to the next page, the paragraph border should take value from the right, not the left. Can I follow this event and make automatic transactions? Thanks... 

s1.png

TOPICS
Scripting

Views

304

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
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 04, 2024 Jan 04, 2024

But you can't apply a stroke to part of a frame in an object style (or even on a frame directly), so you'll have to place separate rules on the frames.

Votes

Translate

Translate
Community Expert ,
Jan 04, 2024 Jan 04, 2024

Copy link to clipboard

Copied

Paragraph borders (and paragraph rules) are not spine-relative, so, no, you can't get what you showed.

 

The only way to deal with this is not to use paragraph borders (or paragraph rules), but instead use a script to place the rules when all margin frames have been placed.

Votes

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
community guidelines
Participant ,
Jan 04, 2024 Jan 04, 2024

Copy link to clipboard

Copied

Hi @Peter Kahrel Thank you very much for your reply.
"Find all text frames for the script and apply object style 1 if they are on the right of the page, apply object style 2 if they are on the left of the page." I will try to develop a code with this logic. Does anyone have a better idea?

Votes

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
community guidelines
Community Expert ,
Jan 04, 2024 Jan 04, 2024

Copy link to clipboard

Copied

But you can't apply a stroke to part of a frame in an object style (or even on a frame directly), so you'll have to place separate rules on the frames.

Votes

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
community guidelines
Participant ,
Jan 05, 2024 Jan 05, 2024

Copy link to clipboard

Copied

Hi everyone,

Hi everyone;



....

var allDocPages = app.documents[0].pages.everyItem().getElements();
// Loop all pages:
for (var n = 0; n < allDocPages.length; n++)

{
// Test Left or Right Hand side of page:
//if (allDocPages[n].side == PageSideOptions.LEFT_HAND) { //Left (Odd)
if (allDocPages[n].side == PageSideOptions.RIGHT_HAND)

{ //Right (Even)
// Get all items on the current page:
var mySelection = allDocPages[n].allPageItems;
for (var i = 0; i < mySelection.length; i++)
{
if ((mySelection[i].constructor.name == "TextFrame") && (mySelection[i].appliedObjectStyle == myOs1_O))

....

I solved the problem with the script I prepared using this logic. Thanks @Peter Kahrel 

Votes

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
community guidelines
Community Expert ,
Jan 05, 2024 Jan 05, 2024

Copy link to clipboard

Copied

As your TFs are Anchored - you don't have to check all TFs on all Pages - you could just iterate TFs collection of the Story.

 

It will be quicker / more efficient.

 

Votes

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
community guidelines
Community Expert ,
Jan 06, 2024 Jan 06, 2024

Copy link to clipboard

Copied

And a version that doesn't require scripting knowledge:

 

BEFORE:

RobertTkaczyk_0-1704586742435.png

 

AFTER:

RobertTkaczyk_1-1704586751291.png

(those thick green and red lines are for better visibility)

 

Right now it needs few runs to complete - change from "...is EVEN" to "...is ODD" in the 1st Task and re-run - but it will be just one task with 2nd and 3rd Tasks run as a sub-Tasks.

And then it could be run in BatchMode on a multiple folders full of INDD files...

 

Votes

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
community guidelines
Community Expert ,
Jan 06, 2024 Jan 06, 2024

Copy link to clipboard

Copied

LATEST

And that's an example of a single, fully automatic Task:

 

RobertTkaczyk_1-1704594782607.png

 

Votes

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
community guidelines
Community Expert ,
Jan 05, 2024 Jan 05, 2024

Copy link to clipboard

Copied

Good job. Tip for the future: when you place text frames (like your margin frames) always label them on the Layers panel. That way they easy to find so that when you go looking for frames in a script, the script uses less code and is more efficient (and quicker too, usually).

Votes

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
community guidelines
Guide ,
Jan 05, 2024 Jan 05, 2024

Copy link to clipboard

Copied

Sometimes, complex things just need InDesign basic features as 2 object styles and a simplistic regex! …

Screenshots previously posted not allowed.

 

(^/)  The Jedi

Votes

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
community guidelines
Community Expert ,
Jan 05, 2024 Jan 05, 2024

Copy link to clipboard

Copied

Clever, mon brave. So you paste an object into the anchored frames. And how do you get the arrows to point into the correct direction?


Another thing is that the rules should be the length of the height of the boxes. How would you adjust the height of the objects you paste?

Votes

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
community guidelines