Copy link to clipboard
Copied
Hi!
I just started with writing Scripts for InDesign, and was wondering, if it is possible to save the values the User entered in my Dialog and use them as defaults when he executes the script next time?
It would be nice, if you could save them in the indd-file he was using the script, so when he is opening the indd-file again his defaults still persist.
But its also ok if the values only persist for the duration of one session.
Do you have any advices?
Thanks!
Sure it's possible. The simplest way to do it is to write a document label:
myDocument.insetLabel("Animal Selected", "Cow");
This can then be extracted as so:
myDocument.extractLabel("Animal Selected");
The beauty is that document labels are stored alongside the document, so any time the user opens that document, their choices can be read.
It is also possible to store a label in the application itself -- in the same way as above.
So it's up to you to decide whether you want the user's choices to be do
...Copy link to clipboard
Copied
Sure it's possible. The simplest way to do it is to write a document label:
myDocument.insetLabel("Animal Selected", "Cow");
This can then be extracted as so:
myDocument.extractLabel("Animal Selected");
The beauty is that document labels are stored alongside the document, so any time the user opens that document, their choices can be read.
It is also possible to store a label in the application itself -- in the same way as above.
So it's up to you to decide whether you want the user's choices to be document-specific or application-specific.
Ariel
Copy link to clipboard
Copied
Brilliant! I will test this!
Are there any naming convention i should consider, so i don't interfere with other scripts or indesign itself?
Copy link to clipboard
Copied
Hi elhodel ,
there is one key word with insertLabel() you should be aware of.
And that is the string "Label".
With that you do a "Script Label" entry the user is able to see if done on a regular item on the page like a rectangle or a text frame.
Before running the snippet just select a rectangle on the page:
app.selection[0].insertLabel( "Label" , "Message not hidden anymore from the UI.");
app.selection[0].label // Returns string "Message not hidden anymore from the UI."
Open the Script Label Panel to inspect the value of property "label" of the selected rectangle:
Regards,
Uwe