2 Replies Latest reply on Jun 17, 2015 6:54 PM by Sights333

    Help on writing mini-plugin to run windows .exe on photo

    Beholder003

      Hi,

       

      I seek to run the windows version of dcraw on a selected picture via plugin and then have the plugin automatically import the resulting TIF image back into LR so it is displayed beside the original raw file.

      I am no developer at all but understand that plugins can be created with some scripting code.

      I tried something like this here but failed:

       

      local LrTasks = import 'LrTasks'

      local LrApplication = import 'LrApplication'

       

      local catalog = LrApplication.activeCatalog()

          local cat_photos = catalog.targetPhotos   

              for i, photo in ipairs(cat_photos) do

                  local file = photo.path

                      LrTasks.startAsyncTask(function()

                          LrTasks.execute(C:programs/dcrawps64.exe "-T" "-4" "-G" "20" "-v" "  ..file..  ")

                      end)

      end

       

      There are a couple of issues:

      a) is the approach ok generally?

      b) I have serious problems with the path to the application. Quotes or not? forward or backslashes used?

      c) I seem to have same issues with getting the blanks and single and double quotes correct.

       

      Any hints anyone?

        • 1. Re: Help on writing mini-plugin to run windows .exe on photo
          flingo Level 1

          Hi,

          on Windows systems, LrTasks.excecute() is tricky:

          - substitute \ by \\\ (this is a Lua issue)

          - surround each pathname that has a space in it with double-quotes (")

          - substitute  > by ^>

          - in addition, surround the whole commandline with double-quotes

           

          Besides that your program path doesn't look correct. It should be:

          C:\programs\dcrawps64.exe

          and therefore in your Lua code, you have to use:

          C:\\\programs\\\dcrawps64.exe

           

          It's a long way...

           

          Martin

          2 people found this helpful
          • 2. Re: Help on writing mini-plugin to run windows .exe on photo
            Sights333

            Not sure how??? but I have been included in this post, but to my knowledge, have never been on there except when trying to find the main LR forum page.I may have inadvertently added myself by the mere act of clicking on the Lightroom SDK link.I have never asked a question nor replied to anyone on this forum - not to my knowledge at least; so getting me off this list of users that regularly get emails from this forum would be very good. The question is - how?