Skip to main content
rudytj
Known Participant
January 29, 2015
Answered

adding a "always" keyword to metatag

  • January 29, 2015
  • 1 reply
  • 332 views

I have (with prior help from you folks) written the below script which is working flawlessly among all my co workers. Till the boss said he want our company name to appear every time in the keyword area.

the way it currently works is the script will automatically fill in certain areas, gather all image names and place them in the keywords and then open the file info dialog box for the worker to add any additional info that would be appropriate.

how can i have the script continue to perform as it is but have the first keyword be my company name?

//-----document title and copyright---------

var myDocument = app.activeDocument;

with (myDocument.metadataPreferences){ 

    copyrightInfoURL = "XXXX.com" 

    copyrightNotice = "© 2015 XXXXX"; 

    copyrightStatus = CopyrightStatus.yes; 

    documentTitle = myDocument.name.split(".indd")[0];

    }

//---------------------add document name-------------------------------

with (myDocument.metadataPreferences){

        documentTitle = myDocument.name.split(".indd")[0];

        }

//-----------------------images to keywords--------------------------//

app.activeDocument.metadataPreferences.keywords = app.activeDocument.links.everyItem().name;

//-------------open file info dialog box---------------------

app.menuActions.itemByID(89092).invoke()

This topic has been closed for replies.
Correct answer Laubender

Why do you ask?

Just add the name in front of the array by concatenating two arrays:

app.activeDocument.metadataPreferences.keywords =

["MyCompanyName"].concat(app.activeDocument.links.everyItem().name);

Note: the names of the links will also include the file suffixes like .tif, .eps etc.

See the documentation at:

Adobe InDesign CS6 (8.0) Object Model JS: MetadataPreference

Adobe InDesign CS6 (8.0) Object Model JS: Array

Adobe InDesign CS6 (8.0) Object Model JS: Array

Uwe

1 reply

rudytj
rudytjAuthor
Known Participant
January 30, 2015

is there a way to insert my company name into the keywords and then have all the image names be inserted? my script above does everything except inserting the company name

i.e. if the indesign document has three images named dog, cat, and fish i want my keywords to be:

Company Name; dog; cat; fish

LaubenderCommunity ExpertCorrect answer
Community Expert
January 30, 2015

Why do you ask?

Just add the name in front of the array by concatenating two arrays:

app.activeDocument.metadataPreferences.keywords =

["MyCompanyName"].concat(app.activeDocument.links.everyItem().name);

Note: the names of the links will also include the file suffixes like .tif, .eps etc.

See the documentation at:

Adobe InDesign CS6 (8.0) Object Model JS: MetadataPreference

Adobe InDesign CS6 (8.0) Object Model JS: Array

Adobe InDesign CS6 (8.0) Object Model JS: Array

Uwe

rudytj
rudytjAuthor
Known Participant
January 30, 2015

I am new and never concatenated (had to look up that word) ....this is exactly what i needed....THANK YOU!!!!