<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.0.12-alpha" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>Jeffrey Friedl's Blog</title>
	<link>http://regex.info/blog</link>
	<description>Not a photo blog, but sometimes I play one on TV</description>
	<pubDate>Fri, 04 Jul 2008 14:48:33 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.12-alpha</generator>
	<language>en</language>
			<item>
		<title>Lightroom &#8220;Run Any Command&#8221; Piglet</title>
		<link>http://regex.info/blog/photo-tech/anycommand/</link>
		<comments>http://regex.info/blog/photo-tech/anycommand/#comments</comments>
		<pubDate>Tue, 22 Jan 2008 06:26:23 +0000</pubDate>
		<dc:creator>Jeffrey Friedl</dc:creator>
		
		<category>General</category>

		<guid isPermaLink="false">http://regex.info/blog/lightroom-run-any-command-piglet/</guid>
		<description><![CDATA[

 

<br style='display:block;margin:5px'/>This page describes my &#8220;Run Any Command&#8221; Lightroom Piglet, which
allows the technically savvy user to run any command with each image
exported via one of my Lightroom export plugins
(&#160;Zenfolio
&#160;&#183;&#160;
SmugMug
&#160;&#183;&#160;
Flickr
&#160;&#183;&#160;
Picasa Web&#160;),
or via any export plugin that uses my piglet infrastructure.

<br style='display:block;margin:5px'/>This &#8220;Run Any Command&#8221; piglet is
already included 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.

<br style='display:block;margin:5px'/>Even though the piglet is included with my plugins, like all piglets, it
must be enabled from the Piglet Manager before it can be used the first
time. As [...]]]></description>
			<content:encoded><![CDATA[

<style type="text/css">
#t699    { border-bottom: solid 1px #282828 }
#t699 td { border-top: solid 1px #282828; border-right: solid 1px #282828; vertical-align: baseline }
#t699 tr td:first-child { border-left: solid 1px #282828 }
#t699 tt { font-weight: bold }
#t699 span.add_d { font-size: 70%; color: #666 }
#t699 span.add_n { margin-left:2px }
p.h  { font-weight: bold; font-size: 120%; margin-top: 40px }
th.h { border-bottom: solid 2px #555; font-weight: bold; }
</style>

<p>This page describes my &#8220;<b>Run Any Command</b>&#8221; Lightroom <a
href='http://regex.info/blog/2008-01-15/692'>Piglet</a>, which
allows the technically savvy user to run any command with each image
exported via one of my Lightroom export plugins
(&nbsp;<a class='quiet' href='http://regex.info/blog/photo-tech/lightroom-zenfolio/'>Zenfolio</a>
&nbsp;&middot;&nbsp;
<a class='quiet' href='http://regex.info/blog/photo-tech/lightroom-smugmug/'>SmugMug</a>
&nbsp;&middot;&nbsp;
<a class='quiet' href='http://regex.info/blog/photo-tech/lightroom-flickr/'>Flickr</a>
&nbsp;&middot;&nbsp;
<a class='quiet' href='http://regex.info/blog/photo-tech/lightroom-picasaweb/'>Picasa Web</a>&nbsp;),
or via any export plugin that uses my <a
href='http://regex.info/blog/2008-01-15/692'>piglet infrastructure</a>.</p>

<p>This &#8220;Run Any Command&#8221; 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 <a href='/LightroomPlugins/releases/AnyCommand-20080206.5.zip'>AnyCommand-20080206.5.zip</a>. Version history
is shown below.</p>

<p>Even though the piglet is included with my plugins, like all piglets, it
must be enabled from the Piglet Manager before it can be used the first
time. As described on the <a class='quiet'
href='http://regex.info/blog/2008-01-15/692'>piglet page</a>, you can bring
up the Piglet Manager from the bottom-most section of the export dialog of
any of my export plugins. You then enable the piglet:</p>

<div class='ic' style='margin:0 auto'><img indexhint='left' src="http://regex.info/i/lr/Piglet-AnyCmd-pmd.png" width="671" height="375" class="raw"/></div>

<p>After restarting Lightroom, you'll have a section in the export dialog
that allows you to enter a command. Here's what it might look like with a
command already entered:</p>

<div class='ic' style='margin:0 auto'><img indexhint='left' src="http://regex.info/i/lr/Piglet-AnyCmd-Section.png" width="682" height="308" class="raw"/></div>

<p>Later, during the actual export, the command is run after Lightroom
generates each export file, but before the plugin does other things with
the file (such as uploading the image to Flickr, in the case of my
Export-to-Flickr plugin).</p>

<p class='h'>Command Metasequences</p>

<p>Within the text entered for the command, special sequences are recognized and replaced by image-specific values with each execution:</p>

<table id='t699' cellpadding='5' style='margin-left:5em' cellspacing='0'>
<tr><th class='h'>Sequence</th><th class='h'>Replaced By</th><th class='h'>Added In</th></tr>
<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>
<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>
<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>
<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>



<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>
<tr><td><tt>{FOLDER}</tt></td><td>Full path of the (likely temporary) folder that the exported file was originally exported to.
                                  <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>
<tr><td><tt>{EXPORTED}</tt></td><td>Full path of the file as originally exported.
                                    <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>
<tr><td><tt>{exported}</tt></td><td>Name of the file file as originally exported, without path.
                                    <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>
<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>
<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>
<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>
<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>
<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>
</table>



<p>Be warned that you must be very careful about where to quote items:
anything that has a space or other special shell variables must be quoted,
but exactly what must be quoted, when, and with what kind of quotes is
dependent on the operating system. It's fairly straightforward on a Mac:
using single quotes will almost always be okay, double quotes probably okay
in most cases as well. On Windows, use double quotes and cross your
fingers.</p>

<p>As an example, you'll notice that in the screenshot above (which was
made on Windows XP), I've quoted the command name (the full path to my
<b>exiftool</b> install) because the path has a space in the name (in
&#8220;Program Files&#8221;). I've also quoted <tt>{FILE}</tt> because the image
filename may have a space in it as well (e.g. &#8220;Documents and Settings&#8221;).</p>

<p class='h'>ExifTool</p>

<p>This example command uses Phil Harvey's most-excellent <a
href='http://www.sno.phy.queensu.ca/~phil/exiftool/'>exiftool</a> command
to strip out the thumbnail that Lightroom embeds in its exported images. The command is:</p>

<div style='margin-left:2em'>
<tt>"C:\Program Files\ExifTool\exiftool.exe" &nbsp;&nbsp; -overwrite_original &nbsp;&nbsp; -Photoshop:ALL= &nbsp;&nbsp; "{FILE}"</tt>
</div>

<p>Using other permutations of arguments, you can do a <i>lot</i> with your
images with exiftool and this piglet. It's with exiftool in mind that <a
href='http://www.flickr.com/photos/mark_sirota'>Mark Sirota</a> first
suggested this piglet to me, at which point I thought &#8220;<i>duh, why didn't I
think of that?</i>&#8221; and, so, now here it is.</p>

<p class='h'><a name='history' style='text-decoration:none'>Version History</a></p>
<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.

</td></tr><tr valign='baseline'><td><a name='4'>20080130.4</a></td><td>Added support for <tt>{folder}</tt>, <tt>{FOLDER}</tt>,
              <tt>{exported}</tt> {<tt>EXPORTED}</tt>, <tt>{home}</tt>,
              <tt>{desktop}</tt>, <tt>{pictures}</tt>, <tt>{documents}</tt>, and
              <tt>{temp}</tt>. Thanks to <b>mariane</b> <a
              href='http://regex.info/blog/photo-tech/anycommand/#comment-13818'>for the
              ideas</a>.

</td></tr><tr valign='baseline'><td><a name='3'>20080128.3</a></td><td>Tidied up <a
              href='http://regex.info/blog/photo-tech/anycommand/#comment-13764'>some
              mistakes in the translation hooks</a>.
              Interested in doing the translations for my plugins for your favorite language?
              It's a difficult and thankless job, but you earn good karma for giving to the greater community.
              If interested, please contact me (<b>jfriedl</b>&#8205;&#64;&#8205;<b>yahoo.com</b>).

</td></tr><tr valign='baseline'><td><a name='2'>20080124.2</a></td><td>Minor changes

</td></tr><tr valign='baseline'><td><a name='1'>20080122.1</a></td><td>Initial release

'

</td></tr></table>
<style>
#history td { padding-bottom: 10px }
</style>

<style type="text/css">
  #post699 table { border: solid gray 1px }
  #post699 td:first-child { font-weight: bold; padding-right:1em }
  #post699 td p:first-child { margin-top: 0 }
</style>


]]></content:encoded>
			<wfw:commentRss>http://regex.info/blog/photo-tech/anycommand/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
