Skip to content

Instantly share code, notes, and snippets.

@glowinthedark
Last active February 2, 2026 12:10
Show Gist options
  • Select an option

  • Save glowinthedark/8cea5e8bacdf8794a506c2bb411110e2 to your computer and use it in GitHub Desktop.

Select an option

Save glowinthedark/8cea5e8bacdf8794a506c2bb411110e2 to your computer and use it in GitHub Desktop.
Convert macOS .textClipping files to .html and .txt — accept multiple selected files in Finder.app
# in Shortcuts.app right panel (ℹ️):
# [v] Use as Quick Action:
# [v] Finder
# Receive Files from Quick Actions
# Search and add "Run Shell Script"
# Shell: /usr/bin/python3
# Input: Shortcut Input
# Pass Input: <as arguments>
# based on https://apple.stackexchange.com/a/440864/66812
# Search and add: Show Alert > type 'Shell Script Result'
import plistlib
import sys
from pathlib import Path
for filepath in sys.argv[1:]:
clippath = Path(filepath)
with clippath.open('rb') as fi:
plist = plistlib.load(fi)
utf8text = plist['UTI-Data']['public.utf8-plain-text']
html = plist['UTI-Data']['public.html']
clippath.with_suffix(".txt").write_text(utf8text, encoding='utf-8')
clippath.with_suffix(".html").write_bytes(html)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment