Clipboard Monitor: Some Assembly Required

My wife, my best friend and I are in a group chat where we post daily puzzle scores. Occasionally, I'll put together a graph or logger. Because it's a fairly bounded exercise, I use it to evaluate programming languages, frameworks or approaches. This time, I'm taking the pulse on current LLMs' ability to solve the problem, rather than the solution itself.

The Wordle Monitor

The random thought I had this morning was to build a "zero effort" version. Instead of creating some spreadsheet or form to paste scores into, I wanted detect the scores as they enter my clipboard. The automated nature limits its use to my scores only, which is fine as an exercise.

Wordle 1,288 3/6*

πŸŸ¨β¬›πŸŸ¨πŸŸ¨β¬›
πŸŸ©πŸŸ©πŸŸ©β¬›β¬›
🟩🟩🟩🟩🟩

is copied, but this is written to a file:

<timestamp>|Wordle|1,288|3|*

Speak to My Serpent

Ideally, you grab some existing automation program and configure it with a regex. In my case, I already have one a previous exercise (translated to Python regex):

/(Wordle) ([0-9,]+)[ πŸŽ‰]* (\w)\/6(?[*]?)\n([β¬›πŸŸ¨β¬œπŸŸ©\n]+)/

Unfortunately, the internet had other plans. I sent a query to four LLMs (ChatGPT, Claude, Gemini, Meta) and two search engines (Google and Brave) expecting them to suggest an such a tool. Search and AI quality is a moving target, but what I found matched my expectations.

Given the input:

On my mac, when something is copied to a clipboard, I want to check it against a regular expression and perform some action if a match is found. What is a good way to do this?
  • ChatGPT and Claude suggested a working Python script.
  • Gemini and Meta suggested non-working scripts, Python and Applescript respectively.
  • Google and Brave offered up solutions or apps like ClipMenu most of which would not fulfill the need.

It's sad how bad search has gotten. There are friendlier answers to this problem, but running python isn't that hard, right?

Do You Even Python?

Python is one of the most popular programming languages. It's pre-installed on Linux and installable on Windows. Macs used to also have it pre-installed, until a circa 2019 decision to mark the version Apple uses for its own tools private and unavailable to customers. More on that later.

The install steps required aren't particularly arduous, but any guidance I offer isn't likely to age well. This is why basic scripting tools should ship pre-installed! You'll have to do your own homework here.

Solving the Actual Problem

After a few rounds of tweaks, I got something up and running. You can view it in its clearly hacked together glory, here. I added it to launchctl to run at startup and remain available in the background.

What is a Computer, Really?

This example runs on my laptop. It could run on yours. During my research into a mobile version, I receieved this very predictable response:

Apps cannot monitor the clipboard continuously in the background due to security/privacy restrictions.

I guess everyone who does Wordle on a phone is left out in the cold.

Related Posts

Google Bard Missing Feature: Sharing

November 30, 2023

TL:DR - Google removed a feature because Google couldn't respect Google's privacy.

Stay classy, Google.

Oregon Trail (Apple Arcade Version)

April 3, 2021

Do yourself a favor, download an emulator and play the Windows or Mac version from the 1990's. Read on if you want a rant about an unpolished trainwreck.

Apple Notes: This Note Is Unavailable

November 9, 2020

It’s my fucking note Apple. I just want to link to it. On my computer. With a real link that opens a real program. Not one that punts to a browser tab that soft-locks the entire browser because an unnecessary request for TouchID took precedent over: the system, the running application and user input.