{"id":780,"date":"2020-09-16T16:38:07","date_gmt":"2020-09-16T20:38:07","guid":{"rendered":"http:\/\/techministry.blog\/?p=780"},"modified":"2020-09-16T16:38:07","modified_gmt":"2020-09-16T20:38:07","slug":"using-cronicle-the-planning-center-online-api-and-automator-on-a-mac-to-automate-printing-weekly-paperwork","status":"publish","type":"post","link":"https:\/\/techministry.blog\/?p=780","title":{"rendered":"Using cronicle, the planning center online api, and automator on a mac to automate printing weekly paperwork"},"content":{"rendered":"\n<p>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 &#8211; open Matrix view, select the next plan of each service type, click Print, and choose my report.<\/p>\n\n\n\n<p>I&#8217;ve <a href=\"https:\/\/techministry.blog\/2018\/05\/29\/custom-reports-in-planning-center-online\/\">written<\/a> about and <a href=\"https:\/\/techministry.blog\/2019\/09\/26\/custom-reports-in-planning-center-online-part-2\/\">shared<\/a> my PCO custom reports before. I&#8217;ve also shared about how Planning Center makes a <a href=\"https:\/\/techministry.blog\/2019\/02\/28\/controlling-planning-center-live-with-a-stream-deck\/\">robust API<\/a> available to get data and information about your plans.<\/p>\n\n\n\n<p>So, I whipped up a new <a href=\"https:\/\/techministry.blog\/2020\/07\/16\/automating-production-equipment-using-a-chromebox-and-a-scheduling-server\/\">Cronicle<\/a> plugin that does the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Accepts a PCO AppID and Secret Key<\/li><li>Accepts a list of PCO Service Type Id&#8217;s, delimited by semicolon<\/li><li>Accepts the PCO Matrix Custom Report ID and printing parameters (page size, print orientation, print margin)<\/li><li>Loops through the list of provided service types and determines the &#8220;next plan id&#8221; of each service type and adds that to a list. For us, that&#8217;s the next plan in Auditorium 1, and the next plan in Auditorium 2.<\/li><li>Then it builds the URL to generate the PDF just like PCO would do within the browser.<\/li><\/ul>\n\n\n\n<p>Then, the plugin sends a TCP message to a computer running <a href=\"https:\/\/jeffreydavidsz.github.io\/VICREO-Listener\/\">VICREO Listener<\/a> 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 &#8220;Automated Printing&#8221;. I do have to keep Safari logged into my PCO account for this to work, and I chose Safari for this task because it&#8217;s a browser that&#8217;s already installed which I don&#8217;t often use, so it&#8217;s fine to have all downloads automatically go to that Dropbox folder.<\/p>\n\n\n\n<p>Lastly, I made a Folder Action in Automator. If you haven&#8217;t heard about <a href=\"https:\/\/techministry.blog\/2019\/03\/18\/sending-automated-reminders-via-a-slack-webhook-applescript-and-launchd-on-macos\/\">Automator<\/a> for MacOS before, I strongly suggest checking it out. It can do so much. I&#8217;ve used it for all kinds of things. This folder action watches for new files in that &#8220;Automated Printing&#8221; folder, filters out any newly added files that aren&#8217;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&#8217;t need to keep them anyway.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/techministry.blog\/wp-content\/uploads\/2020\/08\/screen-shot-2020-08-26-at-9.58.01-am.png?w=1024\" alt=\"\" class=\"wp-image-790\" \/><\/figure>\n\n\n\n<p>Here&#8217;s a video of the whole plugin in action:<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-rich is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"embed-youtube\"><iframe loading=\"lazy\" title=\"Print Planning Center Online paperwork automatically using the PCO API, Python, and Automator\" width=\"840\" height=\"473\" src=\"https:\/\/www.youtube.com\/embed\/9qdaq_Jexrc?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/div>\n<\/div><\/figure>\n\n\n\n<p>You can get this plugin from my Github repository, <a href=\"https:\/\/github.com\/josephdadams\/CroniclePlugins\">https:\/\/github.com\/josephdadams\/CroniclePlugins<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &#8211; open Matrix view, select the &hellip; <a href=\"https:\/\/techministry.blog\/?p=780\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Using cronicle, the planning center online api, and automator on a mac to automate printing weekly paperwork&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[11,46],"class_list":["post-780","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-automation","tag-planning-center"],"_links":{"self":[{"href":"https:\/\/techministry.blog\/index.php?rest_route=\/wp\/v2\/posts\/780","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techministry.blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techministry.blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techministry.blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techministry.blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=780"}],"version-history":[{"count":0,"href":"https:\/\/techministry.blog\/index.php?rest_route=\/wp\/v2\/posts\/780\/revisions"}],"wp:attachment":[{"href":"https:\/\/techministry.blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=780"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techministry.blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=780"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techministry.blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=780"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}