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.

Google News Removes Purchased Magazines

November 16, 2023

From my e-mail:

Google News

Hello,

Since 2020, new purchases of magazines have not been available in Google News and very few users now regularly access their magazine subscriptions. We wanted to inform you that support for magazine content in Google News is being discontinued beginning on December 18, 2023, which means access from Google News apps or news.google.com to the library of magazines you previously purchased or subscribed to will be removed.

Toolsmith

November 18, 2022

Fred Brooks, ACM Allen Newell Award acceptance speech:

Any thing which has to call itself a science isn’t. By this criterion, physics, chemistry, geology, and astronomy may be sciences; political science, military science, social science, and computer science are not.

We make things that do not themselves directly satisfy human needs, but which others use in making things that enrich human living. In a word, the computer scientist is a toolsmithβ€”no more, but no less. It is an honorable calling.