Last active
August 29, 2015 14:06
-
-
Save zemax/ca7724ffd05b8f347c4b to your computer and use it in GitHub Desktop.
This file contains hidden or 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 the text content of the active layer in the clipboard | |
* Author: Maxime Cousinou | |
* | |
* Installation: | |
* - Copy the script in your Photoshop/Presets/Scripts directory | |
* - Create an Action with a keyboard shorcut for quick access (cf http://www.tranberry.com/photoshop/photoshop_scripting/tips/script_shortcut.html) | |
**/ | |
var activeLayer = app.activeDocument.activeLayer; | |
if (activeLayer.kind == LayerKind.TEXT) { | |
var txt = activeLayer.textItem.contents; | |
// Remove F*cking ETX char | |
txt = txt.replace(/\x03/g, '\n'); | |
const keyTextData = app.charIDToTypeID('TxtD'); | |
const ktextToClipboardStr = app.stringIDToTypeID( "textToClipboard" ); | |
var textStrDesc = new ActionDescriptor(); | |
textStrDesc.putString( keyTextData, txt ); | |
executeAction( ktextToClipboardStr, textStrDesc, DialogModes.NO ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment