how to apply my script to all opened files?
Hi,
I'm trying to replace the content of text variables in my PSD thanks to a javascript script.
The script works but I'd like to push it a little bit further
I'd like to apply this script to all opened files. Ideally I'd like to get in a variable the list of all opened documents and then use a for loop to go through all items and apply my loop.
See my script below:
if(app.documents.length != 0){
var doc = app.activeDocument;
var headline = "new headline"
var body = "new body copy"
var cta = "you're going to be rich sucker"
var url = "http://www.nicesite.com"
for(i = 0; i < doc.artLayers.length; ++i){
var layer = doc.artLayers;
if(layer.name == "headline"){
layer.textItem.contents = headline;
}
if(layer.name == "body"){
layer.textItem.contents = body;
}
if(layer.name == "cta"){
layer.textItem.contents = cta;
}
if(layer.name == "url"){
layer.textItem.contents = url;
}
}
}
Would you mind sharing some code which could allow me to apply this treatment to all the open files I have in my photoshop environment?
Thanks
