Last active
September 26, 2015 19:37
-
-
Save moluapple/1148519 to your computer and use it in GitHub Desktop.
[Photoshop] Text Contents Collector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
function layersText(oDoc) { | |
var oLayers = oDoc.layers, text = [], i, j, file; | |
function getTextLayers(oLayers, i) { | |
for (i = 0; i < oLayers.length; i++) { | |
oLayers[i].layers ? getTextLayers(oLayers[i].layers, j) : oLayers[i].kind == LayerKind.TEXT && text.push(oLayers[i].textItem.contents); | |
} | |
} | |
getTextLayers(oLayers, i); | |
file = new File(String(oDoc.fullName).replace(/(psd|tiff?)$/i, 'txt')); | |
file.open('w'); | |
file.write(text.join('\n')); | |
file.close(); | |
} | |
var oDocs = app.documents, len = oDocs.length, d = 0; | |
for (; d < len; d++) layersText(oDocs[d]); | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment