I wondered how I would approach it if I were completely new to this environment. There are quite a few ways to write a background process that glues two components together. If it were random, I’d probably pick a way to do it that wasn’t very supportable. I might even choose a way to do it that is broken! 😦
Then I asked myself how I want him to do it. What would be the easiest to maintain as we go forward. And for that, there is absolutely no question what’s the right answer.
WRITE A TOOL.
I put that in capital letters and boldfaced it because it is the absolutely number one best answer for any bit of code you want to write to run in the OPML Editor. It’s also a good place to start exploring, because all the power of the environment has been encapsulated. You just put the code in the right place and it’ll run once a minute, hour or overnight. Or in a background thread. Or as a web page. Or… etc etc.
A number of years ago (probably a depressingly large number) we put together the Tools framework for writing apps that run in Frontier. And we even documented it.
And for the most part it hasn’t changed. A tool written ten years ago for Frontier or Radio, will likely still run in the OPML Editor today.
Everything I write is a tool, so you know they aren’t going to break, at least not on my watch. And if there’s a bit of functionality you need that isn’t there, this is the place I would like to add it. Because it will make my programming life easier too.
Another reason to write a Tool is you may want to share it with others, and if you do, they will likely know how to use it.
Update: An excellent up-to-date tutorial on Tools by Andy Sylvester.