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

script to add parent directory to source field

New Here ,
Aug 15, 2020 Aug 15, 2020

Copy link to clipboard

Copied

hello, i have a script i'm working on and i'm stuck here. 

 

i have a var that captures the source folder i'm working out of here, and the username of the computer working

 

var sourceFolderName = doc.path.name;

var userName = $.getenv('USER');

 

in part of the script i put the username into a metadata field here, and place the source folder into the keywords section of metada, but i'd rather it be in the "Source" field. 

 

doc.info.credit = userName;
var keywords = doc.info.keywords;
keywords.push(sourceFolderName);
doc.info.keywords = keywords;

 

i started to name the new rows to this

 

var source = doc.info.source;
source.push(sourceFolderName);
doc.info.source = source;

 

but that results in an error "ReferenceError: source.push is not a function: on line 88"

TOPICS
Actions and scripting

Views

147

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
Adobe
People's Champ ,
Aug 15, 2020 Aug 15, 2020

Copy link to clipboard

Copied

LATEST
info.source is a string, not an array (see scripting docs).
Therefore, the push function is not applicable.
 
Instead of this
 
var source = doc.info.source;
source.push(sourceFolderName);
doc.info.source = source;

use
 
doc.info.source = sourceFolderName;

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