Quantcast
Channel: Adobe Community: Message List - Photoshop Scripting
Viewing all articles
Browse latest Browse all 27456

My script only runs the action on document #3?

$
0
0

What im trying to do is, open all the files in a given layout folder. then switch between open document

and run an action that will add two sets of trim(or outline) around each of the images. However,

when i test my script it only runs the action on the last of the opened documents. I do see it

switching between them after they are opened, but it does nothing to them. Is this because

it takes time to run the actions? should it all be done through script instead of combining the two methods?

if so, what would be the correct way to add a trim (expand canvas by a certain color)? Thanks so much for

your time and help. it's greatly appreciated.

__________________________________________________

#target photoshop

app.bringToFront();

 

// first close all the open documents

while (app.documents.length) {

app.activeDocument.close()

}

 

var layoutNumber = prompt('Please Enter layout Number');

 

 

OpenFolder();

Switch();

 

 

function OpenFolder() {

        var fileList = inputFolder.getFiles();

        for ( var i = 0; i < fileList.length; i++ )

                    open(fileList[i])

 

 

}

function Switch() {

                    var openDocuments = app.documents.length

        for ( var a = 0; a < openDocuments; a++ )

                    app.activeDocument = app.documents[a]

                    Trim();

}

 

 

function Trim(){

                        app.activeDocument.flatten()

                    app.doAction('GoldTrim','Robs');

        }

 

________________________________________________


Viewing all articles
Browse latest Browse all 27456

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>