Mac .textClipping to .txt
by David Moss
Macintosh computers have a wonderful feature that allows you to highlight text in any window and drag it onto the desktop, or into a folder.
Not so wonderful is the fact no other program but Finder can use the files it creates. The suffix of these exotic files is .textClipping and the text is stored in the resource fork of the file, not the data fork of this peculiar Macintosh file format.
Dealing with just one of these files is hard enough, but I produced over a hundred of them by dragging text out of Facebook for sentiment analysis. I intended to import the text into NVivo. Dragging and dropping the .TextClipping files into NVivo did not work. NVivo simply couldn’t understand them. Nothing but Finder can understand them.
Browsing the web revealed this is a common problem and no-one has a drag and drop solution to it. So should I painstakingly redo my data capture, creating an individual file for each clipping, drag, drop and save each? Why would I spend tens of minutes doing that when I could spend hours creating a drag and drop solution?
I decided to use Apple Automater. Immediately I hit the first roadblock. Out of the box Automator has no way of ingesting a large number of files and dealing with them one by one. Fortunately Nyhthawk Productions created an ad-on for Automater called “Dispense Items Incrementally” that solves this problem. You can download it here.
With the add-on installed I wrote an Automator app that allows the user to drop a file, or set of .textClipping files onto it, extracts the text from the resource fork and saves each as a .txt file in a target folder.
I added a 1 second pause between the rename and the loop because Automater only allows the number of seconds since midnight as a filename in the rename block.
Once the .textClipping files had been converted the resulting .txt files can be dragged and dropped into NVivo to be imported normally.
The Automator tool I created can be downloaded below: