Last active
December 19, 2019 05:23
-
-
Save praveenvijayan/b4c367f4b903a3f9f250 to your computer and use it in GitHub Desktop.
Copy text directly from text layer. Works above photoshop cs6. Copy following script file into /Applications/Adobe Photoshop CC 2014/Presets/Scripts (MAC) or C:\Program Files\Adobe\Adobe Photoshop CC 2014\Presets\Scripts (WIN). Assign shortcut for easy access (cmd+option+c / ctrl+alt+c)
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
/***************************************************************** | |
* | |
* Copy Layer text 1.0 - by Praveen Vijayan! - http://www.decodize.com/ | |
* | |
* Compatibility above Photoshop CS6 | |
* | |
* Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/ | |
* | |
*****************************************************************/ | |
if(app.activeDocument.activeLayer.kind == LayerKind.TEXT){ | |
const keyTextData = app.charIDToTypeID('TxtD'); | |
const ktextToClipboardStr = app.stringIDToTypeID( "textToClipboard" ); | |
var textStrDesc = new ActionDescriptor(); | |
textStrDesc.putString( keyTextData, app.activeDocument.activeLayer.textItem.contents ); | |
executeAction( ktextToClipboardStr, textStrDesc, DialogModes.NO ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I confirm that it doesn't work with CS6, you get that:
Error 8800: General Photoshop error occurred. This functionality may not be available in this version of Photoshop.
Line: 16
-> executeAction( ktextToClipboardStr, textStrDesc, DialogModes.NO );
In that case, you will need that script: http://www.bram.us/2008/03/16/ps_bramustextexport-13-automatically-export-all-text-layers-from-photoshop-psd-to-a-text-file/ (works also with CS3 and CS6)