Skip to content

Instantly share code, notes, and snippets.



Last active Apr 30, 2016
What would you like to do?
Script to convert TextExpander snippets to Texpand


$ ./ <.textpander file> <.txt file>

Import the .txt file into Texpand app.

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=
import plistlib
import time
import json
import sys
if len(sys.argv) < 3:
print 'Please, inform the input and output file'
mapping = {
'%d': '[day/n]',
'%m': '[month/n]',
'%Y': '[year/nf]',
'%clipboard': '[clipboard]',
def replace_mappings(text):
for k, v in mapping.iteritems():
text = text.replace(k, v)
return text
def convert(source):
target = {
'app_exclusions': [],
'phrases': [
'shortcut': snippet['abbreviation'],
'phrase': replace_mappings(snippet['plainText']),
'description': snippet['label'],
'usage_count': snippet['useCount'],
'timestamp': long(time.mktime(snippet['creationDate'].timetuple()) * 1000),
'expands_immediately': False,
'expands_within_word': False,
'disable_smart_case': False,
for snippet in source['snippetsTE2']
return json.dumps(target)
source = plistlib.readPlist(open(sys.argv[1]))
result = convert(source)
with open(sys.argv[2], 'w') as f:

This comment has been minimized.

Copy link

@lukaz-m lukaz-m commented Apr 30, 2016

Hi there ! I've been searching for something like this. How do I use it? My text expander snippets file is .textexpanderbackup . . Do I place the file inside the folder then run the command? Sorry for being such newbie

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment