Graphic46
Active member
- Oct 2, 2018
- 401
- 88
- 28
Hi all !
I need a script that will write all the letters one by one on the blank background and save it. I searched the internet and found this below code. it numbers one by one to any number. but I need A to Z letter.
how to change code for to sort alphabetically ?
so this code export images = #1 #2 #3 #4 #5 ...
but i need A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
can someone help me? thanks.
I need a script that will write all the letters one by one on the blank background and save it. I searched the internet and found this below code. it numbers one by one to any number. but I need A to Z letter.
how to change code for to sort alphabetically ?
so this code export images = #1 #2 #3 #4 #5 ...
but i need A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
can someone help me? thanks.
JavaScript:
function main() {
//this just checks if you have a text layer selected
try {
var textLayer = activeDocument.activeLayer.textItem
} catch (e) {
alert("active layer isn't a text layer");
return
};
// PNG save options to use below, using defaults
var pngOpts = new PNGSaveOptions();
pngOpts.compression = 1;
pngOpts.interlaced = false;
var loops = 5,
outputFolder = Folder.selectDialog('', Folder.desktop); //this will ask for an output folder
for (var i = 0; i < loops; i++) {
var myNum = i + 1;
textLayer.contents = "#" + myNum; //this will change layer contents to number only. if you need some text here, write it in quotes like textLayer.contents = "my text" + myNum;
activeDocument.saveAs(new File(outputFolder + "/#" + myNum + ".png"), pngOpts, true, Extension.LOWERCASE);
}
}
app.activeDocument.suspendHistory("temp", "main()");