• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Where's the best place for a script to store data? CS4

People's Champ ,
Jul 21, 2010 Jul 21, 2010

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

TOPICS
Scripting

Views

1.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 21, 2010 Jul 21, 2010

Copy link to clipboard

Copied

insertLabel() into whatever static object you'd like (like the root paragraph style for example).

Harbs

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jul 21, 2010 Jul 21, 2010

Copy link to clipboard

Copied

Interesting. Thanks Harbs.

Ariel

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 21, 2010 Jul 21, 2010

Copy link to clipboard

Copied

For a document, I'd use Document.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 21, 2010 Jul 21, 2010

Copy link to clipboard

Copied

Ah yeah. I always forget. I don't remember which version they added that...

Harbs

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 21, 2010 Jul 21, 2010

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 21, 2010 Jul 21, 2010

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jul 21, 2010 Jul 21, 2010

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 21, 2010 Jul 21, 2010

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jul 21, 2010 Jul 21, 2010

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jul 22, 2010 Jul 22, 2010

Copy link to clipboard

Copied

LATEST

Thanks guys, this discussion has been very helpful.

Ariel

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines