Copy link to clipboard
Copied
Hi,
I'm writing a script that needs to store some data in each document that it's run in (I would like the user to be able to store default preferences for the script).
I've thought of getting the script to create a master page + text frame with data. But is there anywhere better and perhaps less visible?
Thanks,
Ariel
Copy link to clipboard
Copied
insertLabel() into whatever static object you'd like (like the root paragraph style for example).
Harbs
Copy link to clipboard
Copied
Interesting. Thanks Harbs.
Ariel
Copy link to clipboard
Copied
For a document, I'd use Document.
Copy link to clipboard
Copied
Ah yeah. I always forget. I don't remember which version they added that...
Harbs
Copy link to clipboard
Copied
I just checked it up. I was confused.
It was Application that got insertLabel() and extractLabel() in CS3. It looks like Document always had it.
My bad...
Harbs
Copy link to clipboard
Copied
Cool. Never used either function, but is this one meant for storing application-wide data? Does that work, even after a restart?
Copy link to clipboard
Copied
Hey!
Well, if you use 'app.activeDocument.insertLabel()' then it's stored with document, even after restart, but document must be saved.
If you use 'app.insertLabel()' then it's automaticaly stored, and can be used even after restart.
Great way to use it for script settings.
tomaxxi
Copy link to clipboard
Copied
If I'm not mistaken, app.insertLabel() is lost when preferences are trashed, so for storing script settings that you want to survive prefs being trashed, you're better off storing them in a file somewhere...
Harbs
Copy link to clipboard
Copied
Hey!
Well, I'm not sure, maybe I have to try it.
Another thing is that you can't set label while script window is open...
And if you are doing script with doScript with undo option, you will undo label setting too...
tomaxxi
Copy link to clipboard
Copied
Thanks guys, this discussion has been very helpful.
Ariel