5 Replies Latest reply on Jul 8, 2012 7:43 PM by areohbee

    Assertion Failed for catalog.createKeyword

    Minneapolis Glyn

      I am new to developing on the Lightroom SDK and am trying to build a script to add keywords to a catalog.  Here is the contents of the current script:

       

      local LrApplication = import 'LrApplication'

      local LrDialogs = import 'LrDialogs'

      local catalog = LrApplication.activeCatalog()

       

       

      GKMenuItem = {}

       

       

      function GKMenuItem.runProcess()

                catalog:withWriteAccessDo("SetKeywords",GKMenuItem.setKeywords())

       

       

      end

       

       

      function GKMenuItem.setKeywords()

                local test='Default'

                local catPhotos = catalog.targetPhotos

                local myKeyword = catalog.createKeyword( 'XYZA: test', {}, true, nil  )

       

       

                for _, photo in ipairs( catPhotos ) do

                          -- Loop through each of the photos.

                          -- photo.setKeyword(myKeyword)

       

       

                          LrDialogs.message(test)

                end

       

       

      end

       

       

      import 'LrTasks'.startAsyncTask( GKMenuItem.runProcess )

       

      The problem I have is that I get an 'Assertion Failed!' message for the createKeyword statement whenever this is run.   I've tried a lot of variations without success.  Using Lightroom 3.6 on OSX Lion 10.7.4.

       

      Any ideas would be appreciated!

       

      Thanks

      Glyn