Are different files named with the "_large," "_medium," and "_small;" or are these the names you give the files after you run your action? Using scripting can do whatever you want to do. You can use the scriptListener to record playing an action, then just change the name of the action in the generated code to switch to whatever action you want. If you want all three sized from one file, you can do this too, by creating a snapshop of the file before anything is done to it and revert back to it for each action.
Thank you for the quick reply.
Yes the files already have names ending with "_large", "_medium" and "_small". My problem is how do I make the script check what the name of the currently opened image ends at, and then use the correct action based on that.
For example, when I use the script on an image named "7843_i_large" it will call the action "ResizeLarge". When I use the script on an image named "9985_small" it will call the action "ResizeSmall", and so on. The file name before the suffix should be irrelevant to the script.
1 person found this helpful
Somthing like this might work. You would need to edit this code and put in your actions names and the action set where indicated.
var docRef = activeDocument
var docName = docRef.name.split('.');
var docSize = docName.split('_');
runAction('large Action Name');//enter action name
runAction('medium Action Name');//enter action name
runAction('Small Action Name');//enter action name
var idPly = charIDToTypeID( "Ply " );
var desc2 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref1 = new ActionReference();
var idActn = charIDToTypeID( "Actn" );
ref1.putName( idActn, actionName );
var idASet = charIDToTypeID( "ASet" );
ref1.putName( idASet, "Your Action Set Name" );//Change this
desc2.putReference( idnull, ref1 );
executeAction( idPly, desc2, DialogModes.ALL );
app.displayDialogs = DialogModes.NO;
};//end funcrion runAction
Oh, thanks a ton for writing that. I just got home and tested this.
Unfortunately, in Photoshop nothing happens, while in the ExtendScript Toolkit I seem to be getting Result: Undefined right after "switch (docSize)". Does that mean I messed up adding my actions' names in there?
My actions are (quite aptly) named "Large", "Medium" and "Small", under the "Resize" set, so I replaced them as noted in those 4 lines, yet I can't seem to make it work.
Um, ok I don't know anything about scripting but doing a bit of googling on the .split command I managed to fix it by adding  at the end of var docSize = docName.split('_'). Hope this didn't mess anything else up!
So I assume that number tells it to select the 2nd part of the split. Is there any simple way to make it always select the last part of the split? So as to have it work regardless of how many underscores the file name might have.
Still, code works great, thank you very much
I made a goof in the code. Use these two lines to replace lines 4 & 5:
var docName = docRef.name.split('.').split('_');
var docSize = docName[docName.length-1]
I might not understand how it works, but it's absolutely perfect. Thank you very much!
Great! glad it works.