6 Replies Latest reply on May 16, 2016 11:52 AM by johnrellis

    Applescript to get caption

    dbooster

      Back when I used Aperture I had Applescripts in place that would automatically copy things like the photo caption, filename, title, etc, to the clipboard. Must easier to do it that way. I'm finally starting to think of how to automate my LR workflow in the same way I used to for Aperture, so I'm wondering if there is a way to easily copy certain metadata. Of course I know there is the "Metadata...Copy Metadata" command which does have a hotkey assigned to it, but the problem with that is once I open that menu I have to use the mouse to get what I need. It's kind of tough to automate. Any easier way or any Applescript command to quickly grab what I need?

       

      Thanks!

       

      David

        • 1. Re: Applescript to get caption
          john beardsworth Adobe Community Professional & MVP

          No AppleScript. Instead Lightroom automation is via Lua which is cross-platform.

           

          For your specific problem, see my Search and Replace plugin.

           

          John

          • 2. Re: Applescript to get caption
            johnrellis Most Valuable Participant

            If you provide more details about what specifically you're trying to accomplish, we might be able to suggest an easier workflow.

            1 person found this helpful
            • 3. Re: Applescript to get caption
              dbooster Level 1

              Sorry if I wasn't clear. I want to very quickly copy metadata with a single hotkey.

               

              For example, in Aperture I wrote Applescripts to copy just about every bit of metadata I could want. If I want to grab the photo title (to the clipboard) I just press cmd+opt+ctrl+t. If I want the Caption, it's cmd+opt+ctrl+c. If I want the Keywrds, it's cmd+opt+ctrl+k, and so on so forth for any bit of metadata I might want.

               

              Having easy single keystroke access to any metadata not only makes it faster for me to pull out data when I post a photo to my website, but also allows me to better automate things with keyboard maestro. As an example, I have a keyboard maestro macro that will grab the currently selected photo in Aperture and will (using the hotkeys to pull out metadata I created) pull out all necessary metadata and build a post to my website automatically.

               

              Is that clear? So basically I just want to easily, using a hotkey and not the mouse, copy various metadata from a photo to the clipboard.

              • 4. Re: Applescript to get caption
                dbooster Level 1

                Sorry, that's not exactly what I want. See my other reply to see me try to explain myself better.

                 

                I didn't know about Lua, though. Thanks for that mention. I will have to research that more.

                • 5. Re: Applescript to get caption
                  john beardsworth Adobe Community Professional & MVP

                  I don't think that's possible with Lightroom, not easily anyway. If you want to do exactly what you describe, you might be able to code an external application which recognises those shortcuts, calls a Lightroom plugin (via a url in the form lightroom://yourpluginname/etc) which returns a specific field's value and sends it your app which then puts the info on the clipboard.

                  • 6. Re: Applescript to get caption
                    johnrellis Most Valuable Participant

                    If you're comfortable with Keyboard Maestro, an easier (but more fragile) solution is to use Maestro scripts to copy out a metadata field.  For example, to copy a photo's keywords to the clipboard, a Maestro script would do these steps:

                     

                    1. Invoke the LR menu command Window > Library (to make sure LR is in the Library module).
                    2. Invoke the command Edit > Select Only Active Photo (and ignore any error if that command is not active), ensuring the Metadata panel shows info for just the most-selected photo (in case more than one photo is selected).
                    3. Invoke the command Photo > Add Keywords...
                    4. Stuff the keystroke Shift + Tab to move to the previous field listing the keywords.
                    5. Invoke Edit > Select All, followed by Edit > Select, followed by Edit > Copy.

                     

                    To copy the caption, in step 4, stuff the appropriate number of tabs to move to the Caption field.

                     

                    As with keyboard macros in general, this is fragile, because the macro usually has to make assumptions about the state of the application's user interface that can't be verified by the macro.  The steps above assume that the right column of panels is open in the Library, and there's no way to ensure that is true; similarly, the steps have to assume which panels in the column are visible and open.

                     

                    The approach sketched by John Beardsworth would be much more robust but a lot more work.  Even if you're an experienced programmer, the learning curve for LR plugins is pretty steep -- assume at least a 8 - 12 hours to get something working reliably.   See my post for how to get started with the LR SDK for plugins.