Skip to main content
Sowiedu
Participant
June 12, 2015
Answered

How to promote a certain image to the top of a stack?

  • June 12, 2015
  • 2 replies
  • 489 views

Hi,

I'm new at this so bear with me.

I have the following code:

#target bridge

function StackIt() {
    var fileList = Folder(app.document.presentationPath).getFiles("*DIFFUSE*");
    for(var a in fileList){
        var firstFile = decodeURI(fileList.name.match(/[^_]*/));
        var filesToStack = Folder(app.document.presentationPath).getFiles("*"+firstFile+"*");
        app.document.deselectAll();
        for(var s in filesToStack){
            app.document.select(new Thumbnail(filesToStack));
        };
    app.document.chooseMenuItem("StackGroup");
    };
};

StackIt();

which works liek a charm.

Now I want to make sure that in all the stacks, the image with the *DIFFUSE* name component is always shown at the top of the stack.

How would I go about that?

This topic has been closed for replies.
Sowiedu
SowieduAuthor
Participant
June 15, 2015

Hey,


Thanks very much it works perfectly

Out of curiosity: What does the "/gi" in the name.match() mean?

Also is there a way to do it faster? As in processing time.

Inspiring
June 15, 2015

I don't know if there is a faster way, I doubt it.

The "g" means global or more than one occurance of what you are trying to match.

T "i" means ignore case so can be uppercase/lowercase or mixed case.