In my never-ending quest to automate anything I ever have to do more than once, I thought that it might be nice if I could have my paperwork/custom reports that I manually print out every Sunday to print out automatically for me. I do the same thing every week – open Matrix view, select the next plan of each service type, click Print, and choose my report.
So, I whipped up a new Cronicle plugin that does the following:
- Accepts a PCO AppID and Secret Key
- Accepts a list of PCO Service Type Id’s, delimited by semicolon
- Accepts the PCO Matrix Custom Report ID and printing parameters (page size, print orientation, print margin)
- Loops through the list of provided service types and determines the “next plan id” of each service type and adds that to a list. For us, that’s the next plan in Auditorium 1, and the next plan in Auditorium 2.
- Then it builds the URL to generate the PDF just like PCO would do within the browser.
Then, the plugin sends a TCP message to a computer running VICREO Listener to open the URL which generates the PDF. This free program is used to send hotkeys remotely to other computers, but it can also execute files and shell scripts. It sends a command to the computer to open the Safari browser with this URL. Safari automatically downloads it to a folder I have in Dropbox, called “Automated Printing”. I do have to keep Safari logged into my PCO account for this to work, and I chose Safari for this task because it’s a browser that’s already installed which I don’t often use, so it’s fine to have all downloads automatically go to that Dropbox folder.
Lastly, I made a Folder Action in Automator. If you haven’t heard about Automator for MacOS before, I strongly suggest checking it out. It can do so much. I’ve used it for all kinds of things. This folder action watches for new files in that “Automated Printing” folder, filters out any newly added files that aren’t PDF files (just in case something else gets put in there by accident), prints out any added files to the default printer, and then deletes the files 5 seconds later. I don’t need to keep them anyway.
Here’s a video of the whole plugin in action:
You can get this plugin from my Github repository, https://github.com/josephdadams/CroniclePlugins