From 2690559d62714e363e0d710f7a0e4ae450d9bda3 Mon Sep 17 00:00:00 2001 From: KevinYobeth Date: Sun, 9 Dec 2018 21:05:05 +0700 Subject: [PATCH] First Commit --- CertificateExport.js | 31 +++++++++++++++++++++++++++++++ SequenceExport.js | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 CertificateExport.js create mode 100644 SequenceExport.js diff --git a/CertificateExport.js b/CertificateExport.js new file mode 100644 index 0000000..e007696 --- /dev/null +++ b/CertificateExport.js @@ -0,0 +1,31 @@ +function saveJPEG( doc, saveFile, qty ) { + var saveOptions = new JPEGSaveOptions( ); + saveOptions.embedColorProfile = true; + saveOptions.formatOptions = FormatOptions.STANDARDBASELINE; + saveOptions.matte = MatteType.NONE; + saveOptions.quality = qty; + doc.saveAs( saveFile, saveOptions); +} + +var layer = activeDocument.layers[0]; +app.displayDialogs = DialogModes.NO; + +if (layer.kind == 'LayerKind.TEXT') { + + var loc = new File("c:/Users/Kevin Claudine/Desktop/Certificate/list.txt"); + + loc.open('r'); + var str = ""; + var counter = 1; + while (!loc.eof){ + + str = loc.readln(); + layer.textItem.contents = str; + saveJPEG( app.activeDocument, new File('Export/' + str + '.jpg'), 12 ); + counter++; + + } + + loc.close(); + +}; \ No newline at end of file diff --git a/SequenceExport.js b/SequenceExport.js new file mode 100644 index 0000000..ffcdf11 --- /dev/null +++ b/SequenceExport.js @@ -0,0 +1,35 @@ +function saveJPEG( doc, saveFile, qty ) { + var saveOptions = new JPEGSaveOptions( ); + saveOptions.embedColorProfile = true; + saveOptions.formatOptions = FormatOptions.STANDARDBASELINE; + saveOptions.matte = MatteType.NONE; + saveOptions.quality = qty; + doc.saveAs( saveFile, saveOptions); +} + +var layer = activeDocument.layers[0]; +app.displayDialogs = DialogModes.NO; + +var start = 201; +var end = 250; + +if (layer.kind == 'LayerKind.TEXT') { + for (var i = start; i <= end; i++) { + + var number; + + if (i < 10){ + number = "000" + i; + } else if (i < 100){ + number = "00" + i; + } else if (i < 1000){ + number = "0" + i; + } else { + number = i; + } + + layer.textItem.contents = number.toString(); + + saveJPEG( app.activeDocument, new File('Export/' + number + '.jpg'), 12 ); + }; +}; \ No newline at end of file