PS_BRAMUS.TextExport 1.2 – Automatically export all Text layers from Photoshop PSD to a Text file

JSXColleague Johan asked whether someone could knock up a script which exports all text layers from a Photoshop document to a text file. Since I’ve scripted Photoshop before (heck, I even steered Photoshop from within C#) it was no biggie for me to knock up a simple script, which I dubbed TextExport

After Johan placed his request, I quickly knocked up a script which loops all layers (1.0), then (pretty important) expanded it to loop groups of layers too (1.1) and finally added some user friendly stuff like giving one the option to choose where to save the file holding all text elements (1.2).

Download

Update November 2008:
PS_BRAMUS.TextExport is outdated and has been replaced with PS_BRAMUS.TextConvert which does both import and export!

Download PS_BRAMUS.TextExport 1.2

Installation / How to use

  • Download PS_BRAMUS.TextExport from the link above
  • Extract it to Presets/Scripts folder of your Photoshop installation folder (defaults to C:\Program Files\Adobe\Adobe Photoshop CS3\Presets\Scripts on Windows)
  • Restart Photoshop if it was already running
  • Open the PSD you wish to export text from
  • Now, when having a file opened, go to File > Scripts and select PS_BRAMUS.TextExport.1.2 from the list. textexport-small.jpg
  • Wait until the output file appears 🙂

Configuration

Three settings in PS_BRAMUS.TextExport can be configured, all to be found in the .jsx file itself.

  • Open up PS_Bramus.TextExport-1.2.jsx with your favorite texteditor
  • If you want to choose where to save the file to, set useDialog to true. If set to false (default), the output file will be saved into your documents folder
  • If you don’t want the exported file to be openend after the export has run, set openFile to false. If set to true (default), the output file will automatically be opened by your default text editor.
  • In the export file, each line is separated by a separator string. Change this one to use one you like (defaults to *************************************).

Example

I’ve tested PS_BRAMUS.TextExport with a pretty complex PSD, which holds the design of 3RDS. Here are the results:

Input PSD

TextExport Input

Output TXT

TextExport Output

Make a donation

It certainly is no obligation but it would most certainly put a smile on my face 😉

Published by Bramus!

Bramus is a frontend web developer from Belgium, working as a Chrome Developer Relations Engineer at Google. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

Unless noted otherwise, the contents of this post are licensed under the Creative Commons Attribution 4.0 License and code samples are licensed under the MIT License

Join the Conversation

9 Comments

  1. Text Layers by default have the same name as the text it holds; What would be neat is to add the structure in order to see what group the layer is in. Will bump a 1.3 sometime soon 😉

  2. Hey,

    This is great! I needed to get the text from 20 PSDs and wasn’t sure how to do it, I had even considered typing up the copy all over again. But this script worked really great.

    I updated the script code to kill the alert prompt that the script generates to notify the user that the text export has been completed and set up a batch so now I can extract the text from a whole folder of PSDs and get the machine to do all the work.

    Thanks a lot :0)

  3. Thanks for sharing, lovely thingy.

    Just pitty it’s kinda slow on huge PSD files with many layers..

    Still thanks a lot for sharing.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.