Lightroom: Keywords on Export

Lightroom: Keywords on Export

A very simple plugin knocked up on the spur of the moment when I needed exported images to get a tag telling me they’d been exported. The plugin works on Lightroom for Mac. It should work on Lightroom for Windows but as yet is untested. See Caveats below for more information.

It’s essentially the standard Lightroom file export but with a couple of things added:

  • One extra input field for keyword(s) (comma separated) that will be added to images as they’re exported.
  • A second extra input field for a post export script.

Installation

  • Download the plugin here and unzip it
  • Either:
    • place it in the default Lightroom plugin folder and restart Lightroom
  • Or:
    • Place it somewhere sensible on your hard drive and use the Lightroom Plugin Manager to install it

Use

Once installed access the plugin from the Lightroom export dialog using the “Export to” dropdown at the top

 

The BFEP export dialog

fig 1. the export dialog.

 

Keywords

Enter one or more keywords in the keyword input box. If you add multiple keywords separate them with commas. Whatever keywords are there will be added to images as they’re exported. The keyword will be created if it doesn’t already exist. In the screen grab above (fig 1.) I’m using ‘Twitter’ as a keyword.

Post Export Script

The Post Export field should be either empty or should contain the full path to a shell script; bash if you’re using a Mac, .cli or .bat if you’re using Windows. Note that this plugin hasn’t yet been tested on Windows (See Caveats below)

Arguments

The plugin sends the post export shell script two arguments; the full path to the exported image followed by the comma separated keyword list. In a bash script use something like this:

imagePath=$1
keyWords=$2

Enter the full path to your shell script in the Post Script input box or browse to it using the “Choose Script” button.

Example Scripts

Email:

Sends an email to the destination of your choice with the exported image attached. See comments in the script for details. This script was originally written to send exported images to social network sites using IFTTT‘s mail to facility. I’ll be talking about using IFTTT with this plugin in a future blog article.

#!/bin/bash

###################################
# Mail.bash (c) Kim Aldis
#
# email script for the Big Fat Export Plugin
# Sends an email with the exported image attached.
# message, if any, can be added by hand in the email before sending.
# If you want to send it automatically just uncomment the --send line
# in the applescript below.
# presumes single keyword only in the second argument; doesn't parse a # keyword list # # OS X only!
#
###################################


{ # redirect output to logger. output can be seen using the console app


########################################################
# BFEP sends over two args; the image path and the keyword or keywords as set in the
# plugin's Keyword field
#

imagePath=$1 keyWord=$2

########################################################
# mailFrom:
#
# Format: "account name" "you@yourdomain.com"
# where 'account name' is the name of the Apple Mail email account
# from which the which you want the mail sent from and 'you@yourdomain.com'
# is the from address of the same account
#
# This field is quite picky. If the format is not right
# Mail.app will just set the send account to the first account it finds in
# its account list
# Check properly that it's working before sending.
#
# to get the account name in Mail.app right click on it, select Get Info
# and check under the Summary tab. You're looking for 'Full Name'

mailFrom="Your Mail Account "

########################################################
# Destination email address

mailTo="test@gmail.com"

########################################################
# Keyword in the subject as a hash
# but use whatever you like

subject="#$keyWord"

osascript << EOF

	tell application "Mail"
		tell (make new outgoing message )
	  		set subject to "$subject"
		  	set content to "Add your message here\n\n"
		  	set visible to true
			set sender to "$mailFrom"
			make new to recipient at end of to recipients with properties {address:"$mailTo", name:"Recipient"}
			make new attachment with properties {file name:(POSIX file "$imagePath")} at after the last paragraph
			--send
		  	end tell
		set a to the name of the first account
	end tell

EOF
} 2>&1 | logger -t BFEP

 

Twitter:

Opens Tweetbot with exported image attached. Add your Tweet text and hit ‘Tweet’.

#!/bin/bash

imagePath=$1

open -a /Applications/Tweetbot.app $imagePath

Caveats

I don’t have access to a Windows machine so none of this has been tested on Windows, not even slightly. The plugin itself should work and, if pointed at a .bat or .cli file the post script may also work but the truth is, I don’t know. Certainly the example code I give here, which uses the bash shell and applescript, won’t unless you have something like Cygwin installed.

If anyone feels like it, by all means have a crack at it, the Lua source has been left open and it’s not really a complex plugin. If you have any luck I’d appreciate hearing how you get on and I’ll update this page with whatever you find.

Pin It on Pinterest

Share This