0 Replies Latest reply on Dec 16, 2010 6:47 AM by neeraj1032

    add images from local drive

    neeraj1032

      I need to develop plugin to import the images from system drives using lua script on the event of a button click i have used catalog.add function it throws no error.
      As i am newbie to lua and lightroom both can you please guide me with
      this is the script that i have written

       

      --[[
           Creating custom dialog
      ]]

      -- Access the lightroom sdk namespace

       

      local LrFunctionContext = import 'LrFunctionContext'
      local LrBinding = import 'LrBinding'
      local LrDialogs = import 'LrDialogs'
      local LrView = import 'LrView'
      local LrApplication = import 'LrApplication'
      local LrTasks = import 'LrTasks'

       


      local function showCustomDialog()
         
          LrFunctionContext.callWithContext( "showCustomDialog", function( context )
         
              local f = LrView.osFactory()
              local fileToAdd="F:\Photographs\NahanTrip\Juli\Image250.jpg"
             
              local c = f:column {
                  spacing = f:dialog_spacing(),
                 
                  f:row {
                      fill_horizontal = 1,
                      f:static_text {
                          alignment = "right",
                          width = LrView.share "label_width",
                          title = "Enter keyword to search the images on corbis",
                      },
                  },
                 
                  f:row {
                      fill_horizontal = 1,
                      f:edit_field {
                          immediate = true,
                          value = "Enter some text!!"
                      },
                     
                      f:push_button {
                          title = "Search",
                          action = function()
                                  local lrphoto = import 'LrPhoto'
                                      outputToLog("Search button clicked.")
                                      oCatalog = LrApplication.activeCatalog()
                                      --oCatalog.add("F:\Photographs\NahanTrip\Juli\Image250.jpg")
                                      status, other = LrTasks.pcall( catalog.addPhoto, oCatalog, fileToAdd)
                                  end
                      },
                  },
                 
              }
             
             
              LrDialogs.presentModalDialog {
                      title = "Corbis Images",
                      contents = c
              }
             
          end)

       

      end

       

      showCustomDialog()  

       

       

       

      Thanks for the previous replies and i need this urgent

       

      Regards,
      Neeraj Gupta