{"id":699,"date":"2008-01-22T15:26:23","date_gmt":"2008-01-22T06:26:23","guid":{"rendered":"https:\/\/regex.info\/blog\/photo-tech\/anycommand"},"modified":"2008-07-29T12:47:57","modified_gmt":"2008-07-29T03:47:57","slug":"anycommand","status":"publish","type":"page","link":"https:\/\/regex.info\/blog\/photo-tech\/anycommand","title":{"rendered":"Lightroom 1 &#8220;Run Any Command&#8221; Piglet"},"content":{"rendered":"\n\n<style type=\"text\/css\">\n#t699    { border-bottom: solid 1px #282828 }\n#t699 td { border-top: solid 1px #282828; border-right: solid 1px #282828; vertical-align: baseline }\n#t699 tr td:first-child { border-left: solid 1px #282828 }\n#t699 tt { font-weight: bold }\n#t699 span.add_d { font-size: 70%; color: #666 }\n#t699 span.add_n { margin-left:2px }\np.h  { font-weight: bold; font-size: 120%; margin-top: 40px }\nth.h { border-bottom: solid 2px #555; font-weight: bold; }\n<\/style>\n\n<p>This page describes my &#8220;<b>Run Any Command<\/b>&#8221; Lightroom <a\nhref='\/blog\/2008-01-15\/692'>Piglet<\/a>, which\nallows the technically savvy user to run any command with each image\nexported via one of my Lightroom export plugins\n(&nbsp;<a class='quiet' href='\/blog\/photo-tech\/lightroom-zenfolio\/'>Zenfolio<\/a>\n&nbsp;&middot;&nbsp;\n<a class='quiet' href='\/blog\/photo-tech\/lightroom-smugmug\/'>SmugMug<\/a>\n&nbsp;&middot;&nbsp;\n<a class='quiet' href='\/blog\/photo-tech\/lightroom-flickr\/'>Flickr<\/a>\n&nbsp;&middot;&nbsp;\n<a class='quiet' href='\/blog\/photo-tech\/lightroom-picasaweb\/'>Picasa Web<\/a>&nbsp;),\nor via any export plugin that uses my <a\nhref='\/blog\/2008-01-15\/692'>piglet infrastructure<\/a>.<\/p>\n\n<p>This &#8220;Run Any Command&#8221; piglet <b style='color:#F22'>is\nalready included<\/b> with my export plugins since January 22, 2008.\nHowever, if you'd like to use the piglet with a different plugin, you can\ndownload <a href='\/LightroomPlugins\/releases\/AnyCommand-20080206.5.zip'>AnyCommand-20080206.5.zip<\/a>\n. Version history\nis shown below.<\/p>\n\n<p>Even though the piglet is included with my plugins, like all piglets, it\nmust be enabled from the Piglet Manager before it can be used the first\ntime. As described on the <a class='quiet'\nhref='\/blog\/2008-01-15\/692'>piglet page<\/a>, you can bring\nup the Piglet Manager from the bottom-most section of the export dialog of\nany of my export plugins. You then enable the piglet:<\/p>\n\n<div class='ic' style='margin:0 auto'><img loading=\"lazy\" decoding=\"async\" indexhint='left' src=\"\/i\/lr\/Piglet-AnyCmd-pmd.png\" width=\"671\" height=\"375\" class=\"raw\"\/><\/div>\n\n<p>After restarting Lightroom, you'll have a section in the export dialog\nthat allows you to enter a command. Here's what it might look like with a\ncommand already entered:<\/p>\n\n<div class='ic' style='margin:0 auto'><img loading=\"lazy\" decoding=\"async\" indexhint='left' src=\"\/i\/lr\/Piglet-AnyCmd-Section.png\" width=\"682\" height=\"308\" class=\"raw\"\/><\/div>\n\n<p>Later, during the actual export, the command is run after Lightroom\ngenerates each export file, but before the plugin does other things with\nthe file (such as uploading the image to Flickr, in the case of my\nExport-to-Flickr plugin).<\/p>\n\n<p class='h'>Command Metasequences<\/p>\n\n<p>Within the text entered for the command, special sequences are recognized and replaced by image-specific values with each execution:<\/p>\n\n<table id='t699' cellpadding='5' style='margin-left:5em' cellspacing='0'>\n<tr><th class='h'>Sequence<\/th><th class='h'>Replaced By<\/th><th class='h'>Added In<\/th><\/tr>\n<tr><td><tt>{FILE}<\/tt><\/td><td>The name of the exported image file, with full path<\/td><td class='added'><span class='add_d'>20080123.<\/span><span class='add_n'>2<\/span><\/td><\/tr>\n<tr><td><tt>{file}<\/tt><\/td><td>The name of the exported image file, without the leading path<\/td><td class='added'><span class='add_d'>20080123.<\/span><span class='add_n'>2<\/span><\/td><\/tr>\n<tr><td><tt>{NAME}<\/tt><\/td><td>The name of the exported image file, with full path, but without the file extension<\/td><td class='added'><span class='add_d'>20080123.<\/span><span class='add_n'>2<\/span><\/td><\/tr>\n<tr><td><tt>{name}<\/tt><\/td><td>The name of the exported image file, without the leading path and without the file extension<\/td><td class='added'><span class='add_d'>20080123.<\/span><span class='add_n'>2<\/span><\/td><\/tr>\n\n\n\n<tr><td><tt>{folder}<\/tt><\/td><td>Full path of the (likely temporary) folder that the exported file lies in<\/td><td class='added'><span class='add_d'>20080130.<\/span><span class='add_n'>4<\/span><\/td><\/tr>\n<tr><td><tt>{FOLDER}<\/tt><\/td><td>Full path of the (likely temporary) folder that the exported file was originally exported to.\n                                  <br\/>This is the same as <tt>{folder}<\/tt> unless the plugin or another piglet has changed the filename<\/td><td class='added'><span class='add_d'>20080130.<\/span><span class='add_n'>4<\/span><\/td><\/tr>\n<tr><td><tt>{EXPORTED}<\/tt><\/td><td>Full path of the file as originally exported.\n                                    <br\/>This is the same as <tt>{FILE}<\/tt> unless the plugin or another piglet has changed the filename<\/td><td class='added'><span class='add_d'>20080130.<\/span><span class='add_n'>4<\/span><\/td><\/tr>\n<tr><td><tt>{exported}<\/tt><\/td><td>Name of the file file as originally exported, without path.\n                                    <br\/>This is the same as <tt>{file}<\/tt> unless the plugin or another piglet has changed the filename<\/td><td class='added'><span class='add_d'>20080130.<\/span><span class='add_n'>4<\/span><\/td><\/tr>\n<tr><td><tt>{home}<\/tt><\/td><td>Full path of the user-dependent &#8220;home&#8221; folder<\/td><td class='added'><span class='add_d'>20080130.<\/span><span class='add_n'>4<\/span><\/td><\/tr>\n<tr><td><tt>{desktop}<\/tt><\/td><td>Full path of the user-dependent &#8220;Desktop&#8221; folder<\/td><td class='added'><span class='add_d'>20080130.<\/span><span class='add_n'>4<\/span><\/td><\/tr>\n<tr><td><tt>{pictures}<\/tt><\/td><td>Full path of the user-dependent picture folder (&#8220;My Pictures&#8221; or &#8220;Pictures&#8221;)<\/td><td class='added'><span class='add_d'>20080130.<\/span><span class='add_n'>4<\/span><\/td><\/tr>\n<tr><td><tt>{documents}<\/tt><\/td><td>Full path of the user-dependent document folder (&#8220;My Documents&#8221; or &#8220;Documents&#8221;)<\/td><td class='added'><span class='add_d'>20080130.<\/span><span class='add_n'>4<\/span><\/td><\/tr>\n<tr><td><tt>{temp}<\/tt><\/td><td>Full path of a system-dependent temporary folder<\/td><td class='added'><span class='add_d'>20080130.<\/span><span class='add_n'>4<\/span><\/td><\/tr>\n<\/table>\n\n\n\n<p>Be warned that you must be very careful about where to quote items:\nanything that has a space or other special shell variables must be quoted,\nbut exactly what must be quoted, when, and with what kind of quotes is\ndependent on the operating system. It's fairly straightforward on a Mac:\nusing single quotes will almost always be okay, double quotes probably okay\nin most cases as well. On Windows, use double quotes and cross your\nfingers.<\/p>\n\n<p>As an example, you'll notice that in the screenshot above (which was\nmade on Windows XP), I've quoted the command name (the full path to my\n<b>exiftool<\/b> install) because the path has a space in the name (in\n&#8220;Program Files&#8221;). I've also quoted <tt>{FILE}<\/tt> because the image\nfilename may have a space in it as well (e.g. &#8220;Documents and Settings&#8221;).<\/p>\n\n<p class='h'>ExifTool<\/p>\n\n<p>This example command uses Phil Harvey's most-excellent <a\nhref='http:\/\/www.sno.phy.queensu.ca\/~phil\/exiftool\/'>exiftool<\/a> command\nto strip out the thumbnail that Lightroom embeds in its exported images. The command is:<\/p>\n\n<div style='margin-left:2em'>\n<tt>\"C:\\Program Files\\ExifTool\\exiftool.exe\" &nbsp;&nbsp; -overwrite_original &nbsp;&nbsp; -Photoshop:ALL= &nbsp;&nbsp; \"{FILE}\"<\/tt>\n<\/div>\n\n<p>Using other permutations of arguments, you can do a <i>lot<\/i> with your\nimages with exiftool and this piglet. It's with exiftool in mind that <a\nhref='http:\/\/www.flickr.com\/photos\/mark_sirota'>Mark Sirota<\/a> first\nsuggested this piglet to me, at which point I thought &#8220;<i>duh, why didn't I\nthink of that?<\/i>&#8221; and, so, now here it is.<\/p>\n\n<p class='h'><a name='history' style='text-decoration:none'>Version History<\/a><\/p>\n<table id='history' style='padding:5px'><tr valign='baseline'><td><a name='5'>20080206.5<\/a><\/td><td>Allowed the codes like {FILE} and {name} to be translated.\n\n<\/td><\/tr><tr valign='baseline'><td><a name='4'>20080130.4<\/a><\/td><td>Added support for <tt>{folder}<\/tt>, <tt>{FOLDER}<\/tt>,\n              <tt>{exported}<\/tt> {<tt>EXPORTED}<\/tt>, <tt>{home}<\/tt>,\n              <tt>{desktop}<\/tt>, <tt>{pictures}<\/tt>, <tt>{documents}<\/tt>, and\n              <tt>{temp}<\/tt>. Thanks to <b>mariane<\/b> <a\n              href='\/blog\/photo-tech\/anycommand\/#comment-13818'>for the\n              ideas<\/a>.\n\n<\/td><\/tr><tr valign='baseline'><td><a name='3'>20080128.3<\/a><\/td><td>Tidied up <a\n              href='\/blog\/photo-tech\/anycommand\/#comment-13764'>some\n              mistakes in the translation hooks<\/a>.\n              Interested in doing the translations for my plugins for your favorite language?\n              It's a difficult and thankless job, but you earn good karma for giving to the greater community.\n              If interested, please contact me (<b>jfriedl<\/b>&#8205;&#64;&#8205;<b>yahoo.com<\/b>).\n\n<\/td><\/tr><tr valign='baseline'><td><a name='2'>20080124.2<\/a><\/td><td>Minor changes\n\n<\/td><\/tr><tr valign='baseline'><td><a name='1'>20080122.1<\/a><\/td><td>Initial release\n\n'\n\n<\/td><\/tr><\/table>\n<style>\n#history td { padding-bottom: 10px }\n<\/style>\n\n<style type=\"text\/css\">\n  #post699 table { border: solid gray 1px }\n  #post699 td:first-child { font-weight: bold; padding-right:1em }\n  #post699 td p:first-child { margin-top: 0 }\n<\/style>\n\n\n","protected":false},"excerpt":{"rendered":"<p>This page describes my \"<b>Run Any Command<\/b>\" Lightroom Piglet, which allows the technically savvy user to run any command with each image exported via one of my Lightroom export plugins (&nbsp;Zenfolio &nbsp; - &nbsp; SmugMug &nbsp; - &nbsp; Flickr &nbsp; - &nbsp; Picasa Web&nbsp;), or via any export plugin that uses my piglet infrastructure.<\/p> <p>This \"Run Any Command\" piglet <b style='color:#F22'>is already included<\/b> with my export plugins since January 22, 2008. However, if you'd like to use the piglet with a different plugin, you can download AnyCommand-20080206.5.zip . Version history is shown below.<\/p> <p>Even though the piglet is included with [...]","protected":false},"author":1,"featured_media":0,"parent":251,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":{"footnotes":""},"_links":{"self":[{"href":"https:\/\/regex.info\/blog\/wp-json\/wp\/v2\/pages\/699"}],"collection":[{"href":"https:\/\/regex.info\/blog\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/regex.info\/blog\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/regex.info\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/regex.info\/blog\/wp-json\/wp\/v2\/comments?post=699"}],"version-history":[{"count":0,"href":"https:\/\/regex.info\/blog\/wp-json\/wp\/v2\/pages\/699\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/regex.info\/blog\/wp-json\/wp\/v2\/pages\/251"}],"wp:attachment":[{"href":"https:\/\/regex.info\/blog\/wp-json\/wp\/v2\/media?parent=699"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}