Highlighted

What is RubyString and can I use it this (no meant for that) way?

Explorer ,
Sep 09, 2020

Copy link to clipboard

Copied

Hello everyone,

 

I worked a lot on a script that changes all the paragraphs of my document to single column instead of span column for performance reasons. This script must also change all the paragraphs back to their original value if run again. So I had the idea to use a "string" attribute of paragraphs that seems not used at all. I found in the documentation (https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Paragraph.htmlRubyString and change the original value to {1} or {0} (span column or single column (the original value is empty). This way I can save and close my document and those variables remain.

 

If I understood, Ruby is for the japanese version of indesign. So as an european user who won't need ruby, is that ok to use it this way? Is there any restriction in indesign that could change this value other than with my script? Or maby another way I didn't think about?

 

All the best,

Nicolas

 

P.S. I'm using indesign 2020, last build on mac os catalina.

Adobe Community Professional
Correct answer by Laubender | Adobe Community Professional

Hi Brian,

there is no property label in the ExtendScript DOM for paragraph objects. Or any other texts objects.

So I think that the idea of Nicolas is very good one. Unless a user with a Japanese version of InDesign opens and changes the document or another script that implemented the same idea is run on the text, everything should work as expected.

 

A different idea would be to apply a condition.

 

Regards,
Uwe Laubender

( ACP )

TOPICS
Scripting

Views

55

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

What is RubyString and can I use it this (no meant for that) way?

Explorer ,
Sep 09, 2020

Copy link to clipboard

Copied

Hello everyone,

 

I worked a lot on a script that changes all the paragraphs of my document to single column instead of span column for performance reasons. This script must also change all the paragraphs back to their original value if run again. So I had the idea to use a "string" attribute of paragraphs that seems not used at all. I found in the documentation (https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Paragraph.htmlRubyString and change the original value to {1} or {0} (span column or single column (the original value is empty). This way I can save and close my document and those variables remain.

 

If I understood, Ruby is for the japanese version of indesign. So as an european user who won't need ruby, is that ok to use it this way? Is there any restriction in indesign that could change this value other than with my script? Or maby another way I didn't think about?

 

All the best,

Nicolas

 

P.S. I'm using indesign 2020, last build on mac os catalina.

Adobe Community Professional
Correct answer by Laubender | Adobe Community Professional

Hi Brian,

there is no property label in the ExtendScript DOM for paragraph objects. Or any other texts objects.

So I think that the idea of Nicolas is very good one. Unless a user with a Japanese version of InDesign opens and changes the document or another script that implemented the same idea is run on the text, everything should work as expected.

 

A different idea would be to apply a condition.

 

Regards,
Uwe Laubender

( ACP )

TOPICS
Scripting

Views

56

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
Sep 09, 2020 0
Contributor ,
Sep 09, 2020

Copy link to clipboard

Copied

I'll be watching this thread, hoping real experts answer, but I wonder this: Why not simple use a script toggle between Span Columns and Single Column? If the paragraph is spanning columns, change it to single column. And vice versa.

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...
Sep 09, 2020 1
Explorer ,
Sep 10, 2020

Copy link to clipboard

Copied

Hi Robert,

 

Good question, the thing is some paragraphs should stay single all the time, so a toggle wouldn't work without knowing the initial value. That's why I needed to "attach" a variable to each paragraphs.

 

Nicolas

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...
Sep 10, 2020 0
Adobe Community Professional ,
Sep 09, 2020

Copy link to clipboard

Copied

I would just tag each paragraph that's changed with a label flag: myPar.label = "changed";  

Then, when you run the script: 

if (myPar.label == "changed") { 

    set span...

    myPar.label = "";    

}

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...
Sep 09, 2020 0
Adobe Community Professional ,
Sep 09, 2020

Copy link to clipboard

Copied

Hi Brian,

there is no property label in the ExtendScript DOM for paragraph objects. Or any other texts objects.

So I think that the idea of Nicolas is very good one. Unless a user with a Japanese version of InDesign opens and changes the document or another script that implemented the same idea is run on the text, everything should work as expected.

 

A different idea would be to apply a condition.

 

Regards,
Uwe Laubender

( ACP )

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...
Sep 09, 2020 0
Adobe Community Professional ,
Sep 09, 2020

Copy link to clipboard

Copied

That's what I get for responding before coffee.

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...
Sep 09, 2020 1
Advisor ,
Sep 10, 2020

Copy link to clipboard

Copied

Or, insert a note into the para. Although, the note might get deleted.

 

P.

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...
Sep 10, 2020 0
Explorer ,
Sep 10, 2020

Copy link to clipboard

Copied

Thanks Uwe

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...
Sep 10, 2020 0