Skip to main content
Known Participant
August 18, 2023
Question

Retaining styles Copy and Paste JSX Scripting INDESIGN

  • August 18, 2023
  • 3 replies
  • 840 views

Hello 

 

Please may someone inform me if scripting using JSX for InDesign allows for the copy and pasting of the formatt of text. 

For example I have made a script which can break a single text frame devided into many equal separate text columns (as adobe are super poor at giving usful tools) - but when the text appears in the separate threaded boxes the formattting is gone 

the script replaces the single text frame box with separate text frame boxes and pastes back in the text 

but i cannot make it paste with the og formatting - interesting only justfication will be pasted as it is not a character format etc

also i have made a script where a user can just select unthreaded boxes and it will auto thread

but again for some reason formatting is losst and altered even though no copy paste funtion should be happening 

any ideas why it is so difficult thanks 


This topic has been closed for replies.

3 replies

Inspiring
August 18, 2023

I have a script that breaks a multi-column text frame into individual threaded frames. There's no copying and pasting, the story just flows from one frame to the next with styling intact.  Would that help?

Known Participant
August 18, 2023

Hello Robert

Thank you for your feedback, yes that is very interesting. 

Would be kind enough to provide me with the code so I can learn from it.

Best

Smyth

brian_p_dts
Community Expert
Community Expert
August 18, 2023

You should include your code, but sounds like you need to use the text frame .duplicate method to create your copies rather than whatever you're doing. 

Known Participant
August 18, 2023

Hello, 

Thank you for the feeback. 

Allow me to look into this. Does that allow for the formatting of text to be retained, for example text in which the font size and colour and so on may be modified by a user where they do not use paragraph or character styles?

Best


m1b
Community Expert
Community Expert
August 18, 2023

In your script, please check if you are setting the "contents" of a text object. If so, then you will often lose the formatting. Instead have a look at using .move or .duplicate. An example using duplicate is in my script from this post.

- Mark

Known Participant
August 18, 2023

Thank you 

I will have a look shortly

May thanks