Skip to main content
loyal_operator154A
Legend
November 14, 2014
Answered

Is it possible to store script settings with InDesign file?

  • November 14, 2014
  • 2 replies
  • 2213 views

Hi,

I have some crazy idea: is it possible to store script settings with InDesign file?

In that case scripters will be able to store those settings with file, and when script runs - it can check if those setting exists - if so - script can run without showing dialogue with parameters... (as all necessary parameters stored with indesign file), and of course we can force InDesign to show script parameters dialogue if we run it with alt/option key pressed while running this script. Maybe even different scripts will be able to share those settings and interact with each other.. we will be able to have settings that will be saved with file, or temp settings for current document or session (till InDesign is closed). With eventListeners and startup scripts we will be able to do scripts that would be able to check for updates, and automatically execute when we placing images and text, and so on.. this can be a whole InDesign scripting framework, that allow to write scripts that will use same libraries and ui so we don't have to write everything from scratch everytime and just included required libs..

so here is 2 main questions for now:

1) is it possible to store script settings with .indd file

2) who is intrested in creation InDesign scripting framework (because this only makes sense if many people will use it)

PS: I know that it's possible to store settings in external file, but this time I'm interested only for saving params with .indd

This topic has been closed for replies.
Correct answer loyal_operator154A

Function syntax for writing label:

app.activeDocument.insertLabel('myLabel', 'myLabelValue');

IMPORTANT: If we forget label name, label is LOST! Really?!?! YEAH, REALLY! :D

Function syntax for reading label:

var myLabel = app.activeDocument.extractLabel('myLabel');

http://indisnip.wordpress.com/2010/07/31/saving-script-data-within-document/

2 replies

tobiask43046735
Inspiring
December 8, 2016
loyal_operator154A
loyal_operator154AAuthorCorrect answer
Legend
November 16, 2014

Function syntax for writing label:

app.activeDocument.insertLabel('myLabel', 'myLabelValue');

IMPORTANT: If we forget label name, label is LOST! Really?!?! YEAH, REALLY! :D

Function syntax for reading label:

var myLabel = app.activeDocument.extractLabel('myLabel');

http://indisnip.wordpress.com/2010/07/31/saving-script-data-within-document/

Community Expert
November 18, 2014

No. Not really. Nothing is lost. :-)
You could crack open an IDML file of the document and find the keys and the values…

It's stored in the designmap.xml part of the IDML file.

<Properties>

    <Label>

        <KeyValuePair Key="MyKeyString" Value="MyValueString"/>

    </Label>

</Properties>

Uwe

loyal_operator154A
Legend
November 18, 2014

ah, of cource InDesign don't know if I remeber variable name, and it store it somewhere... but it's not cool to export file to idml and search in XML those labels..

I wish I could get them like:

app.activeDocument.properties.labels.keyValuePair["MyKeyString"];

or something like this...