$ ./te2t.py <.textpander file> <.txt file>
Import the .txt file into Texpand app.
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| # pylint: disable= | |
| #qpy:2 | |
| #qpy:console | |
| import plistlib | |
| import time | |
| import json | |
| import sys | |
| if len(sys.argv) < 3: | |
| print 'Please, inform the input and output file' | |
| sys.exit(0) | |
| 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: | |
| f.write(result) |
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