Amywhiteman
New Member
- Messages
- 4
- Likes
- 0
Hi All,
I am trying to streamline the digital asset management process (woo!). I am trying to figure out a way to write a script that will pull all file names from my photoshop document and put them into the File Info as keywords. Someone on the Adobe forums graciously helped me out with a script that pulls the top layer names from my photoshop document. But I am looking to pull all the layer names not just the top. Let me know if you think it is possible!
Thanks!!
Here is the Javascript
#target photoshop
// community.adobe.com/t5/Photoshop/Copy-photoshop-layer-names-and-paste-into-IPTC-keywords/m-p/10714597
/*
// Active layer name to keywords
var doc = app.activeDocument;
var layerName = doc.activeLayer.name;
var layerNameArray = new Array(layerName);
doc.info.keywords = layerNameArray;
alert('Keywords overwritten with active layer name');
*/
// gist.githubusercontent.com/vladocar/1628924/raw/a486566b2a648f94399fffa67dc9a2b4d681b86e/layerNames.js
// Get the top level layer names for groups and layers, layers in groups are ignored
var layerNum = app.activeDocument.layers.length;
var allLayers = [];
for (var i = 0; i < layerNum; i++) {
allLayers = app.activeDocument.layers.name; // RegEx placeholder - name.replace(/find/gi, 'replace')
}
// Add the top level layer names to keywords
app.activeDocument.info.keywords = allLayers;
alert('Keywords overwritten with top-level layer names!');
I am trying to streamline the digital asset management process (woo!). I am trying to figure out a way to write a script that will pull all file names from my photoshop document and put them into the File Info as keywords. Someone on the Adobe forums graciously helped me out with a script that pulls the top layer names from my photoshop document. But I am looking to pull all the layer names not just the top. Let me know if you think it is possible!
Thanks!!
Here is the Javascript
#target photoshop
// community.adobe.com/t5/Photoshop/Copy-photoshop-layer-names-and-paste-into-IPTC-keywords/m-p/10714597
/*
// Active layer name to keywords
var doc = app.activeDocument;
var layerName = doc.activeLayer.name;
var layerNameArray = new Array(layerName);
doc.info.keywords = layerNameArray;
alert('Keywords overwritten with active layer name');
*/
// gist.githubusercontent.com/vladocar/1628924/raw/a486566b2a648f94399fffa67dc9a2b4d681b86e/layerNames.js
// Get the top level layer names for groups and layers, layers in groups are ignored
var layerNum = app.activeDocument.layers.length;
var allLayers = [];
for (var i = 0; i < layerNum; i++) {
allLayers = app.activeDocument.layers.name; // RegEx placeholder - name.replace(/find/gi, 'replace')
}
// Add the top level layer names to keywords
app.activeDocument.info.keywords = allLayers;
alert('Keywords overwritten with top-level layer names!');