Skip to content

cmalec/alfred-snippet-import

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Alfred snippet import from aText

Two scripts to migrate snippets from an aText backup into Alfred 5. Tested on Alfred 5.7.3.

Scripts

atext2csv.py

Parses an aText backup file (.atext) and exports all snippets to CSV. aText backups use Apple's NSKeyedArchive binary plist format; this script decodes that format using Python's stdlib plistlib — no dependencies required.

The CSV columns are: trigger, content, type, type_label, group, name, hotkey, tags, created, modified, rich_content, uuid.

usage: atext2csv [-h] [-o OUTPUT_DIR] [-q] input

positional arguments:
  input            Path to .atext backup file

options:
  -o OUTPUT_DIR    Output directory (default: current directory)
  -q, --quiet      Suppress output

csv2alfred.py

Reads the CSV produced by atext2csv.py and writes Alfred 5 JSON snippet files, one per snippet, organized into subdirectories by group. Each group directory gets an info.plist with Alfred's default prefix/suffix settings. Non-text snippets (scripts, rich text, etc.) are skipped.

Dynamic field conversion: aText uses 【...】-delimited placeholders for dynamic content. Two are converted automatically:

aText Alfred
【clipboard】 {clipboard}
【|】 {cursor}

All other dynamic fields — dates, times, custom input fields — are left as-is and flagged in the output. The script will print a list of affected snippets and point you to the Alfred placeholder docs so you can update them manually. Common ones you may encounter:

aText Alfred equivalent
【date:yyyy-MM-dd 】 {date} / {isodate:yyyy-MM-dd}
【time:"HH:mm:ss" 】 {time}
【field:label options】 no direct equivalent
usage: csv2alfred.py [-h] -o OUTPUT_DIR input

positional arguments:
  input            Path to atext_snippets.csv

options:
  -o OUTPUT_DIR    Alfred snippets root directory (required)
  --text-only      Skip non-text snippets (default: true)

Output structure matches what Alfred expects:

snippets/
├── Default/
│   ├── info.plist
│   ├── my snippet [UUID].json
│   └── ...
├── Terminal/
│   ├── info.plist
│   └── ...
└── ...

Each JSON file looks like:

{
  "alfredsnippet": {
    "snippet": "the expansion text",
    "uid": "A1B2C3D4-...",
    "name": "snippet description",
    "keyword": "trigger"
  }
}

Full pipeline

# 1. Export aText backup to CSV
python3 atext2csv.py "aText Auto Backup 2026-05-05.atext" -o /tmp/atext_export

# 2. Generate Alfred snippets from the CSV
python3 csv2alfred.py /tmp/atext_export/atext_snippets.csv \
    -o ~/Documents/Alfred.alfredpreferences/snippets

Alfred will pick up the new snippets the next time it reloads its preferences. You can force a reload from Alfred Preferences → Features → Snippets.

Finding the Alfred snippets folder

In Alfred Preferences, go to Features → Snippets and click the folder icon — or look in:

~/Library/Application Support/Alfred/Alfred.alfredpreferences/snippets/

If you sync preferences via Dropbox or another location, use that path instead.

Finding your aText backup

aText creates automatic backups you can access from aText → File → Open Backup. The backup files are stored in:

~/Library/Application Support/com.trankynam.aText/Backups/

About

Scripts to go from atext to csv to alfred.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages