{"id":905,"date":"2023-08-21T16:14:48","date_gmt":"2023-08-21T23:14:48","guid":{"rendered":"https:\/\/porkrind.org\/missives\/?p=905"},"modified":"2023-08-21T16:14:48","modified_gmt":"2023-08-21T23:14:48","slug":"automator-is-pretty-sweet","status":"publish","type":"post","link":"https:\/\/porkrind.org\/missives\/automator-is-pretty-sweet\/","title":{"rendered":"Automator Is Pretty Sweet"},"content":{"rendered":"<p>I played around with Apple&#8217;s Automator app when it was first released, but I could never really find a good use for it (I wrote some actions but I would never reliably use them for whatever reason). But I <em>did<\/em> eventual write one that I use constantly.<\/p>\n<p>It&#8217;s a &#8220;Quick Action&#8221;, which means it shows up in Finder when you right click:<\/p>\n<p><a href=\"https:\/\/porkrind.org\/wp-uploads\/2023\/08\/Screenshot-2023-08-21-at-3.56.19-PM.png\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"907\" data-permalink=\"https:\/\/porkrind.org\/missives\/automator-is-pretty-sweet\/screenshot-2023-08-21-at-3-56-19-pm\/\" data-orig-file=\"https:\/\/porkrind.org\/wp-uploads\/2023\/08\/Screenshot-2023-08-21-at-3.56.19-PM.png\" data-orig-size=\"629,505\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Screenshot 2023-08-21 at 3.56.19 PM\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/porkrind.org\/wp-uploads\/2023\/08\/Screenshot-2023-08-21-at-3.56.19-PM-300x241.png\" data-large-file=\"https:\/\/porkrind.org\/wp-uploads\/2023\/08\/Screenshot-2023-08-21-at-3.56.19-PM.png\" src=\"https:\/\/porkrind.org\/wp-uploads\/2023\/08\/Screenshot-2023-08-21-at-3.56.19-PM.png\" alt=\"\" width=\"629\" height=\"505\" class=\"aligncenter size-full wp-image-907\" srcset=\"https:\/\/porkrind.org\/wp-uploads\/2023\/08\/Screenshot-2023-08-21-at-3.56.19-PM.png 629w, https:\/\/porkrind.org\/wp-uploads\/2023\/08\/Screenshot-2023-08-21-at-3.56.19-PM-300x241.png 300w\" sizes=\"auto, (max-width: 629px) 100vw, 629px\" \/><\/a><\/p>\n<p>It extremely simple on the Automator side:<\/p>\n<p><a href=\"https:\/\/porkrind.org\/wp-uploads\/2023\/08\/Screenshot-2023-08-21-at-4.07.14-PM.png\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"911\" data-permalink=\"https:\/\/porkrind.org\/missives\/automator-is-pretty-sweet\/screenshot-2023-08-21-at-4-07-14-pm\/\" data-orig-file=\"https:\/\/porkrind.org\/wp-uploads\/2023\/08\/Screenshot-2023-08-21-at-4.07.14-PM.png\" data-orig-size=\"1053,656\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Screenshot 2023-08-21 at 4.07.14 PM\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/porkrind.org\/wp-uploads\/2023\/08\/Screenshot-2023-08-21-at-4.07.14-PM-300x187.png\" data-large-file=\"https:\/\/porkrind.org\/wp-uploads\/2023\/08\/Screenshot-2023-08-21-at-4.07.14-PM-1024x638.png\" src=\"https:\/\/porkrind.org\/wp-uploads\/2023\/08\/Screenshot-2023-08-21-at-4.07.14-PM.png\" alt=\"\" width=\"1053\" height=\"656\" class=\"aligncenter size-full wp-image-911\" srcset=\"https:\/\/porkrind.org\/wp-uploads\/2023\/08\/Screenshot-2023-08-21-at-4.07.14-PM.png 1053w, https:\/\/porkrind.org\/wp-uploads\/2023\/08\/Screenshot-2023-08-21-at-4.07.14-PM-300x187.png 300w, https:\/\/porkrind.org\/wp-uploads\/2023\/08\/Screenshot-2023-08-21-at-4.07.14-PM-1024x638.png 1024w\" sizes=\"auto, (max-width: 1053px) 100vw, 1053px\" \/><\/a><\/p>\n<p>Note: My real script replaces <code>&lt;my-server&gt;<\/code> with the actual server name.<\/p>\n<p>The key things are to set &#8220;Workflow receives current&#8221; to &#8220;files or folders&#8221;, &#8220;in&#8221; to &#8220;Finder.app&#8221; and in the &#8220;Run Shell Script&#8221; section, &#8220;Pass input&#8221; to &#8220;as arguments&#8221;. I set the Image to &#8220;Send&#8221; because it seemed reasonable.<\/p>\n<p>The script it self is trivial:<\/p>\n<pre><code class=\"language-sh\">. ~\/.bashrc\nfor f in \"$@\"\ndo\n    echo \"$f\"\n    rsync -a \"$f\" &lt;my-server&gt;:\/tmp\ndone\n<\/code><\/pre>\n<p>The trickiest part here is getting SSH working without asking for your password (since this script effectively runs headless). I set up my <code>~\/.bashrc<\/code> to search through ssh-agent socket files to find one that it has permission to read and that has keys. It then sets up environment variables so that ssh uses that agent, giving me password-less ssh nearly 100% of the time.<\/p>\n<p>I actually have several variants of this Automator action that rsync to different places (some of which are watched by inotify and kick other things off when files appear there). It&#8217;s really handy for them to just show up in the Finder right-click menu like that, and I find myself constantly using them to move stuff I&#8217;ve downloaded through my local web browser over to my server. I find it way more reliable than trying to keep the remote server mounted through smb or nfs.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I played around with Apple&#8217;s Automator app when it was first released, but I could never really find a good use for it (I wrote some actions but I would never reliably use them for whatever reason). But I did eventual write one that I use constantly. It&#8217;s a &#8220;Quick Action&#8221;, which means it shows &hellip; <a href=\"https:\/\/porkrind.org\/missives\/automator-is-pretty-sweet\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Automator Is Pretty Sweet<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-905","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/porkrind.org\/missives\/wp-json\/wp\/v2\/posts\/905","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/porkrind.org\/missives\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/porkrind.org\/missives\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/porkrind.org\/missives\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/porkrind.org\/missives\/wp-json\/wp\/v2\/comments?post=905"}],"version-history":[{"count":5,"href":"https:\/\/porkrind.org\/missives\/wp-json\/wp\/v2\/posts\/905\/revisions"}],"predecessor-version":[{"id":914,"href":"https:\/\/porkrind.org\/missives\/wp-json\/wp\/v2\/posts\/905\/revisions\/914"}],"wp:attachment":[{"href":"https:\/\/porkrind.org\/missives\/wp-json\/wp\/v2\/media?parent=905"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/porkrind.org\/missives\/wp-json\/wp\/v2\/categories?post=905"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/porkrind.org\/missives\/wp-json\/wp\/v2\/tags?post=905"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}