Home > InDesign Scripts > Change some Clipboard preferences

Change some Clipboard preferences

There are few useful properties you maybe want to use when copy/paste objects and text in InDesign. You can change them through preferences, but also through scripting. 🙂

First one is really great to use when pasting text from other application like Microsoft Word or other applications. It allows you to preserve text formatting. Good practice is to first get current setting, then change setting, and when script is finished, set old setting back.

//at beginning
var oldPreferStyled = app.clipboardPreferences.preferStyledTextWhenPasting;

//apply new setting
app.clipboardPreferences.preferStyledTextWhenPasting = true;

// do script

//apply old setting
app.clipboardPreferences.preferStyledTextWhenPasting = oldPreferStyled;

Second one is great when working with layers. This allows objects cut or copied from different layers retain their layer assignment when pasted. Again, you can first get current setting like before.

//at beginning
var oldLayerRemember = app.clipboardPreferences.pasteRemembersLayers;

//apply new setting
app.clipboardPreferences.pasteRemembersLayers= true;

// do script

//apply old setting
app.clipboardPreferences.pasteRemembersLayers= oldLayerRemember;

There are few more options but I don’t use them. You can find them in ESTK -> Help -> Object Model Viewer or Jongware’s Object Reference Guide.

Last thing I wanna mention is ability to change several options with ‘properties’ property like this:

app.clipboardPreferences.properties = {preferStyledTextWhenPasting:false, preservePdfClipboardAtQuit:false};

Good, that’s it, I think I covered most of the options here.

Have fun! 😀

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: