20 Replies Latest reply on Aug 13, 2010 8:50 AM by HenningMark

    User Scripting (not plugins) in Lightroom?

    DawMatt Level 3
      Hi,

      I don't know if any of you have been following the Export Keywords problem, but a KB article including a fix has been published about it. http://kb.adobe.com/selfservice/viewContent.do?externalId=kb405074&sliceId=2

      This wouldn't normally be a subject for this forum, but the fix (an SQL update) is delivered via a .lua file that is:
      * installed into a Scripts directory in the Lightroom presets directory (it wasn't present on my system prior to this)
      * Enables a Scripts menu (to the right of the Window menu) and the first item is "Open User Scripts Folder"
      * presents a dialog box (with a few options) that runs the SQL then restarts the product

      Why I'm interested is it appears the Lightroom team has already baked a User Scripting mechanism into the product, beyond the plugin SDKs that have officially been announced. This hints at wider capability for us to extend the product - that certainly grabs my attention.

      This is the first time I've seen any form of scripting (beyond that included in the Plugin SDK) publicly acknowledged albiet indirectly. Does anyone know where to find documentation about User Scripting capabilities/SDK/etc? Can anyone glean additional information from the fix that was published? I'm hoping one of you more experienced development types may be able to shed more light on this.

      Thanks,
      Matt
        • 1. Re: User Scripting (not plugins) in Lightroom?
          Level 1
          Matt,
          At this point we won't be providing any more information about this scripting interface beyond what's available as a solution for the Keyword bug referenced in the KB article. It's an API that the development team can use for troubleshooting or solving specific issues.

          The current Lightroom API has been documented as the SDK available for Web, Metadata or Export Plug-in extensibility only.

          If you do have workflow scenarios that would require a different type of scripting interface, this would be a good place to discuss it.

          Regards,
          Tom
          • 2. Re: User Scripting (not plugins) in Lightroom?
            DawMatt Level 3
            Hi Tom,

            Thanks for the quick (and definitive) feedback. I understand this is a "can of worms" your team isn't quite ready to open yet, but it does bode well for the product's future and the possibility of Lightroom improving feature parity with DAM heavy hitters such as iView.

            I appreciate the invitation to discuss additions to the SDK. I will post regarding my preferred SDK elements in different thread(s) so they don't get buried in this one.

            Thanks,
            Matt
            • 3. Re: User Scripting (not plugins) in Lightroom?
              Level 1
              I really miss the scripting ability I found so useful in Bridge. So, here's a few words about those scripts.

              Most of the scripts I've written are related to DAM and move directories and files around. They show up as context menu items. I have scripts to move image directories between archive and working locations. I also have scripts to move the less useful images off the computer. These DAM-related scripts are the ones I miss most. I cannot use them with a complete commitment to the LR2 catalog because they result in missing images in the catalog and don't deal with virtual copies and other catalog information not written to XMP.

              I have one script that takes a selection of images and creates a specialized web gallery with GPS links to Google Maps for each image (it looks like a BreezeBrowser gallery). I can continue to use this script after I export the photos to JPG from LR.

              Bottom line is that I would love to have the ability to define context menu items in LR2 to implement my scripts to move files and directories around, with the moves being recorded in the LR2 catalog.

              Thanks.
              Guy
              • 4. Re: User Scripting (not plugins) in Lightroom?
                I'm also intrested in this.

                Basically I want to read various metadata fields, Title, Location check for some keywords and then write a string based upon those to the caption metadata field for selected images.

                Is this possible with the current published SDK details - there seem to be functions listed to read and write this data ? Or do I need to await some more formal scripting release as hinted at in this post ?

                Thanks, Martin
                • 5. Re: User Scripting (not plugins) in Lightroom?
                  john beardsworth Adobe Community Professional & MVP
                  Look at setRawMetadata.
                  • 6. Re: User Scripting (not plugins) in Lightroom?
                    Hi,

                    I'm also interrested in user scripting : I'd like to be able to call for exposure change, contrast, color temp, via keyboard shortcuts, which would add a big user experience !

                    Is this possible ?

                    Regards
                    • 7. Re: User Scripting (not plugins) in Lightroom?
                      escouten Adobe Employee
                      Ludovic, changing develop settings is not possible via the Lightroom 2.0 SDK. I understand the interest and it's something we'll consider for a future version of Lightroom.
                      • 8. Re: User Scripting (not plugins) in Lightroom?
                        john beardsworth Adobe Community Professional & MVP
                        Smart develop presets, Eric?
                        • 9. Re: User Scripting (not plugins) in Lightroom?
                          I'd liked to be able to 'drop a folder of images' on a script that launches, assigns a keyword set onto these images, then runs and saved export preset
                          • 10. Re: User Scripting (not plugins) in Lightroom?
                            JW Stephenson Level 4
                            Martin - I have developed the script to do exactly what you describe based on my needs. You may be able to use my script and modify it for your specific needs as well. How do I get sample code to you?
                            • 11. Re: User Scripting (not plugins) in Lightroom?
                              DawMatt Level 3
                              JW,

                              would you be willing to share this code with the rest of us?

                              Thanks,
                              Matt
                              • 12. Re: User Scripting (not plugins) in Lightroom?
                                JW Stephenson Level 4
                                Matt - Be happy to share - how do I go about doing that? Embedding in a message might become difficult to read.
                                • 13. Re: User Scripting (not plugins) in Lightroom?
                                  SeanMcCormack Adobe Community Professional
                                  You can add links in the post as normal html
                                  • 14. Re: User Scripting (not plugins) in Lightroom?
                                    DawMatt Level 3
                                    Hi JW,

                                    Sorry about the delay in responding.

                                    As Sean mentioned, if you have somewhere you can host the script you could include a link in the post. If you don't have anywhere currently it should be pretty simple to create a http://sites.google.com page.

                                    In other forums I'd just PM you and supply an email address privately. In this one... I can't figure out how to do that without inviting spammers to have a field day.

                                    Thanks,
                                    Matt
                                    • 15. Re: User Scripting (not plugins) in Lightroom?
                                      JW Stephenson Level 4
                                      Matt,

                                      I can't figure out how to send a private message either. Just call me at 858-558-9595. Ask for Jeff.
                                      • 16. Re: User Scripting (not plugins) in Lightroom?
                                        Ludovic LEMARINEL,

                                        Yes it is possible to change exposure, temp, recovery, etc by means of keyboard keys. See www.night-ray.com, Lightroom 2.x Enhanced Keyboard Shortcuts by Gordon McKinney as an example. Uses AutoHotKeys which is free.

                                        What is really cool is that you can change these things even if the panel is not visible. So you can have your image full size an press the proper keys to increase/decrease exposure and make other adjustments.

                                        See also http://www.rpgkeys.com/ for a commercial version which drives Lightroom with an auxiliary keypad - X Keys Professional http://www.piengineering.com/xkeys.php?gclid=CPSjIrD65cCFRIcawodSm3nDA
                                        This is pricey and aimed at high volumn wedding photographers.

                                        I am working with AutoHotKeys scripts and whatever else I can find in order to replicate something like RPG Keys. I have gotten pretty far but am stuck on one thing at the present. I need to be able to get the state (checked, enabled) of various menu items so that I can restore them after other operations. I can read the menu with AutoHotkeys and get the various menu items but am unable at present to get their states. This could be because Lightroom does not use a standard menu in which case that avenue is closed. Or it could be because I am not calling the DLL correctly as I am a novice in that area. If anyone has any experience with this, I sure would like to hear.

                                        Larry
                                        • 17. Re: User Scripting (not plugins) in Lightroom?
                                          Level 1
                                          Hi Larry

                                          "I can read the menu with AutoHotkeys and get the various menu items
                                          but am unable at present to get their states. "

                                          If you can read the state of the various items in AutoHotKey, it means
                                          that lightroom allows him to read it :)
                                          So, You miight find a function to read it inside a script.

                                          I'll have a look as soon I'll have a minute :)

                                          Regards
                                          • 18. Re: User Scripting (not plugins) in Lightroom?
                                            Level 1
                                            Ludovic,

                                            Gotit! Now can read the checked and enabled status of each menu item. Was user error, new to this scripting language. There is a function GetMenuItemInfo which is called with a DLL call that returns the structure which can be read.

                                            Now I should be able to set Lightroom to a known state. Read the menu item states of the entire menu, save to file. Then use SetMenuItemInfo, read the file, and set the menu items to the desired values from the file. I think it might take to long but I'll give it a shot.

                                            Setting exposure, temp, etc with a keyboard keys does not seem to be difficult. I've not tried too much with it as I want to see if I can do the hard stuff first.

                                            Next problem. In survey mode, dual screen, with the main window set to Loupe with the panel containing Navigator visible and a 1:1 zoom. This setup allows you to look at the candidates in the 2nd window and see a selected portion of the selected candidate enlarged on the main screen. Now change the selected image in the 2nd window and the enlarged view changes in the main window. Problem is it the new enlarged view is not the same relative area as the first - it is the area that was last selected. I want the same areas to show for each of the candidates. Why? Wedding photographer shoots 4 or more exposures of a large group. Needs to weed out any with closed eyes, bad expressions. Places group images in survey mode, zooms in on a suspicious area in the main screen. Now changes selection and wants to see same area for comparison. But area is different and he must manually move Navigator to the correct area. A pain.

                                            I can get the Navigator window class and the cursor position when the Navigator zoom view rectangle is clicked to a new position so I should be able to save this cursor position and when a new selection is made, move the cursor to the saved position giving the same view area for the new selection. Problem is, how do I hook into the fact that a new selection has been made? Does not seem to be any simple way.

                                            My problem with Lightroom is that there are so many shortcut keys that one could never learn them all. Besides they are not intuitive and require some awkward hand contortions to execute. Only a small subset is required for a given task such as culling a couple of thousand wedding photos. This is a very repetitive task and demands speed. The awkward shortcut keys and use of a mouse really slows things down. With a dedicated keypad with the keys labeled as to function most of the problems go away. The shortcut keys are easily accessible with one hand and you don't have to memorize what each key does (labels). Less mousing and menu use helps the speed. The time savings measures in the hours for the complete task.

                                            Enough rambling. It helps clarify my goal if I try to explain it to someone. I am at the stage where I am analyzing each task that has to be done and seeing if I can speed it up by programming. After I solve the individual tasks, I will combine them into a coherent overall workflow. I will make the code public (AutoHotKeys) when I am finished. You may not like may workflow, but with the functions I have developed, it should be fairly easy to make your own.

                                            Larry
                                            • 19. Re: User Scripting (not plugins) in Lightroom?
                                              One application I'd have for user scripting is to migrate from one keyword hierarchy to another. To do this within Lightroom I think the SDK needs extending to support reading (in a structured manner) and writing keywords.

                                              I'm currently looking at moving from my own ad-hoc keyword hierarchy to a more managed one. The new hierarchy is derived from an external source and will be updated from time to time. Manually updating the photos in the catalogue to reflect this is pretty cumbersome; the old and new hierarchies share a lot of the leaf keywords but the structure is different.

                                              I thought it feasible to script at least part of the migration - by analysing the two keyword trees and finding candidate equivalents. The script could then go through each photo and add the new equivalent keyword (optionally deleting the old). Photo's that couldn't be handled could have a 'problem' keyword added to let the user manually go through these.

                                              At the moment I can't see a way to do this within the Lightroom SDK. It looks plausible that this could be done externally with sqlite3 but I haven't dug into it enough yet.

                                              BTW there is a UI change that might help the manual migration task:

                                              Currently you can drag a keyword from one place in the keyword hierarcy to another place and this moves the references in the photos fine. This is great.

                                              However if the place you're dragging to already has the same keyword then the UI won't let you drop the selected keyword at the proposed destination. For example if I'm dragging from OLD->Animals->Cats to NEW->Organisms->Mammals and 'Cats' already exists under 'Mammals' then with the existing behaviour the drag is rejected.

                                              I'd propose at least an option (key modifier maybe) that would change the behaviour to "merge" the two keywords having the same name. This would then add the photos from OLD->Animals->Cats to NEW->Organisms->Mammals->Cats, and delete OLD->Animals->Cats.

                                              A related behaviour change would be to be able to drag a keyword on top of another one (the destination having a different name) and make them merge (taking on the destinations name) rather than the dragged keyword become a child of the target. For example, dragging OLD->Animals->Cat to NEW->Organisms->Mammals->Cats with the current behaviour will create Cat as a child to Cats; the changed behaviour would merge all photos into the Cats keyword.

                                              Thanks,
                                              Stuart
                                              • 20. Re: User Scripting (not plugins) in Lightroom?
                                                HenningMark

                                                Not a perfect solution for what you want, but there is a guy working on a key mapping and scripting solution iin Autohotkey. URL is Paddy-For-lightroom.com