Script that activates Action depending on file-extension
Hi Community!
I want to create a script that, depending on the file extension, activates an Action in Photoshop. I have very little (read none) experience in programming but I want to make the script myself.
I already found that I can "call" a photoshop Action using the "doAction("","") command.
I've already setup an IF/ELSE that either does one Action or the other:
#target photoshop
var origDoc = app.activeDocument;
if ( == ) {
doAction(Mirror&SaveTif,Mirror)
} else {
doAction(MirrorSaveJpeg,Mirror)
}
But I don't know how I tell the script to look at the file-extension and could really use some help on this. how do I look at the origDoc extension (or filename in full?).
I'm sure one of you BRI-LI-ANT minds can help me with this.
EDIT:
Thanks to Stephen A Marsh I find my answer.
For those interested in a super simple script:
#target photoshop
if (app.activeDocument.name.indexOf('tif') != -1) {
app.doAction('MirrorSaveTif', 'Mirror'); }
if (app.activeDocument.name.indexOf('jpg') != -1) {
app.doAction('MirrorSaveJpg', 'Mirror');}
