4 Replies Latest reply on Jan 20, 2016 4:26 PM by johnrellis

    Problem in LR 6 with export post processing action using windows batch file

    ScottBRosenthal

      First, my custom export action worked fine in LR5 and as far as I know in LR6.1. The problem is now using LR6.3. I'm using Windows 8.1.

       

      I have an export action that changes the attribute of all the exported files to read-only. After all the files have been made read-only, the batch file opens Windows Explorer. The problem is that I now get multiple runs of my export action depending on the number of files I'm exporting. For example, up to around 5 files and I get one Explorer window launched at the end. With 20 or so files, I may get three Explorer windows opened. With 150 files, I may get 12 Explorer windows! Debugging it, the problem is that the batch file gets executed multiple times. Here's the contents of the batch file:

       

      @echo off

      echo Processing...

      :loop

      if [%1]==[] goto endloop

      if exist %1 call attrib +R %1

      shift

      goto loop

      :endloop

      echo done!

      rem

      rem echo Open explorer to the folder with the photo(s)

      %SystemRoot%\explorer.exe "%~dp0"

       

      Any ideas why this behavior is now happening? (BTW, I am not using the GPU for processing)

        • 1. Re: Problem in LR 6 with export post processing action using windows batch file
          johnrellis Most Valuable Participant

          This simple post-process .bat file illustrates what you've observed:

           

          @echo off
          echo %* >> \\Mac\Home\Desktop\post.log
          

           

          When I exported 181 files, LR invoked the .bat file 6 times, with the number of file arguments varying from 5 to 32.

           

          In LR 5 and earlier, an export of many pics would process the pics 1 at a time. But in LR 6, export was parallelized to take advantage of multiple processors (cores).  LR divides the selected photos into batches, with a different thread working on each batch.  When a batch is finished, LR invokes the post-processing action on that batch. In general, this is a good thing, since exports go significantly faster in LR 6 than previous versions.

          • 2. Re: Problem in LR 6 with export post processing action using windows batch file
            ScottBRosenthal Level 1

            Thanks johnrellis. Your explanation makes a lot of sense as to the cause. But, if I select "Show in Explorer", it only opens one window. So, somehow there's a way to have just one thing happen after the entire export job completes. Do you know of any way to trigger this? Or better yet, any way to get around this new parallelism behavior with custom actions happening multiple times? I find it hard to believe that this was a design feature.

            • 3. Re: Problem in LR 6 with export post processing action using windows batch file
              ScottBRosenthal Level 1

              I did some further investigation. It turns out that LR limits the command line length to around 1,400 characters. So, depending on the number of photos being exported, plus the path and file name for each photo, one or more command windows will be started. This seems like a new behavior for LR.

               

              To test this, I exported 37 photos. The first complete file name is  E:\Users\Scott\Desktop\Test\Test-1.jpg. With this naming sequence, the first command window processed 35 photos and the second window processed two photos. I then added one character on to the file name (E:\Users\Scott\Desktop\Test\TestA-1.jpg). In this test, the first window processed 34 photos and the second window three photos. Both times the line length was just shy of 1,400 characters.

               

              I hope someone knows how to get around this limit.

              • 4. Re: Problem in LR 6 with export post processing action using windows batch file
                johnrellis Most Valuable Participant

                I don't know how to work around the issue, unfortunately.

                 

                It can be useful to have the post-process actions for the batches run in parallel when the actions themselves consume a lot of CPU.