4 Replies Latest reply on Nov 2, 2009 7:12 PM by Alfie La Peter

    Custom File Naming

    Alfie La Peter

      New to Lightroom and Lua, so be gentle...


      In my plugin I want to create a default setting for how the exported file is named.  I see that with file types I can set the following:


      allowFileFormats = { 'JPEG' },


      Is there any way to do the same thing with filenames so that they default to 'Custom Name - Sequence'?


      Also, is there a predefined variable name for the filename of the exported image?  I've found 'LR_tokenCustomString' but I am unsure where I would define it.


      Any pointers would be appreciated.  Thanks.

        • 1. Re: Custom File Naming
          Alfie La Peter Level 1

          I have given this a try and although it allows me to define LR_tokenCustomString, it doesn't change the exported file's filename:


              updateExportSettings = function( exportSettings )


                  exportSettings.LR_size_resizeType = 'wh'  -- specific width and height
                  exportSettings.LR_maxHeight = 600
                  exportSettings.LR_maxWidth = 800
                  exportSettings.LR_tokenCustomString = "{FileName}"
                  exprotSettings.LR_initialSequenceNumber = 1



          This exports the files as "_-1.jpg" and "_-2.jpg".  I've tried hardcoding a string instead of {FileName} and that doesn't seem to do anything different.  Any other ideas on how to do this?

          • 2. Re: Custom File Naming
            escouten Adobe Employee

            Hi Alfie, I haven't tried this specifically, but I think the following will probably get you closer to what you want:


                    exportSettings.LR_tokens = "{{custom_token}}-{{image_name}}"

                    exportSettings.LR_tokenCustomString = "abcdefg"


            As a general rule, you can create an export preset with the behavior you're trying to create and mimic the contents of that preset in your update function. Just add the LR_ prefix in front of all of the keys in the preset file.

            1 person found this helpful
            • 3. Re: Custom File Naming
              Alfie La Peter Level 1

              Thanks Eric.  That definitely helped.  I made a preset and found the combo that I was looking for:


                      exportSettings.LR_tokens = "{{custom_token}}-{{naming_sequenceNumber_1Digit}}"
                      exportSettings.LR_tokenCustomString = "abcdefg"
                      exportSettings.LR_initialSequenceNumber = 1


              However, it still doesn't work (I still get "_-1.jpg" and "_-2.jpg" for my exported filenames).  I am trying to tie the filename to another variable and I don't want the user to be able to change the filename of the exported image.


              In fact, I've noticed that none of the exportSettings... seem to be working.  I am placing this in the service provider file, which looks like this:


              local LrView = import 'LrView'


                  -- FtpUpload plug-in
              require 'FtpUploadExportDialogSections'
              require 'FtpUploadTask'




              return {
                  updateExportSettings = function( exportSettings )
                  exportSettings.LR_size_resizeType = 'wh'
                  exportSettings.LR_size_maxHeight = 300
                  exportSettings.LR_size_maxWidth = 400
                  exportSettings.LR_tokens = '{{custom_token}}-{{naming_sequenceNumber_1Digit}}'
                  exportSettings.LR_tokenCustomString = 'abcdefg'
                  exportSettings.LR_initialSequenceNumber = 1
                  exportSettings.LR_jpeg_quality = 1
                  exportSettings.LR_export_colorSpace = 'sRGB'
                  exportSettings.LR_collisionHandling = 'ask'


                  showSections = {},


                  allowFileFormats = { 'JPEG' },


                  allowColorSpaces = { 'sRGB' },


                  startDialog = FtpUploadExportDialogSections.startDialog,
                  sectionsForTopOfDialog = FtpUploadExportDialogSections.sectionsForTopOfDialog,
                  processRenderedPhotos = FtpUploadTask.processRenderedPhotos,



              Am I missing something or is this the wrong place for it?

              • 4. Re: Custom File Naming
                Alfie La Peter Level 1

                Are there any situations in which the updateExportSettings hook would be overwritten?  I've checked my syntax over and over again and I'm still stuck.  I put a dialog message before and after the function and they are both called on the loading of the plugin as well as on the export.  I read that there is a special case with hiding the Export Locations section, but are there any other special cases?