Skip navigation
Currently Being Moderated

Problem with writing metatdata

Jun 7, 2009 5:25 PM

I am no Lua coder but am muddling my way through. Here's my problem:

 

I have a dialog set up which allows a user to select from a dropdown any of the currently selected images. The remainder of the dialog will fill with the chosen image's metadata. The user can make changes. When done they press OK and the changes are written back to the catalog.

 

I must be missing something somewhere because whatever image is up when the user presses OK is the source for the metadata. So, all images selected get that image's metadata instead of what was in the fields for each image.

 

Here's the code used to write back the data.

 

 

activeCatalog:withWriteAccessDo( "Plugin Title", function()

local photosToUpdate = activeCatalog.targetPhotos

     for i, photo in ipairs(photosToUpdate) do

 

          photo:setRawMetadata('title',propertyTable.imageTitle)

          photo:setRawMetadata('caption', propertyTable.imageDescription)

          photo:setPropertyForPlugin(_PLUGIN,'relProperty', propertyTable.propertyReleaseStatus)

          photo:setPropertyForPlugin(_PLUGIN,'relPropertyFile',  propertyTable.propertyReleaseFile)

 

     end

end )

 

Any direction would be greatly appreciated! Thanks!
 
Replies
  • Currently Being Moderated
    Jun 8, 2009 5:06 AM   in reply to Gene McCullagh

    Your code looks OK, so it might be in the dialog.

     

    How do you populate the fields when you select the photo from the drop-down?  I am wondering if there is a missing bind_to_object.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 11, 2009 2:00 PM   in reply to Gene McCullagh

    Gene McCullagh wrote:

     

    No, I have the bind_to_object in place. Since the write back code looks OK I am thinking that perhaps having the write back in the same function as the dialog box might be the problem. I could stick it in a separate function to be called after the dialog is closed but I am not sure how to pass the propertyTable on to the next function.  As I said I'm no Lua coder.

     

    Do you think that would work? How do I pass the propertyTable from one function to the other?

    A property table is just another variable.  You can return it and pass it into a function.  Or declare it in a higher/wider scope and treat it as a global variable.  This plugin of mine is open source and uses property tables to exchange data between a dialog and other functions.  Don't know whether it will resolve your problem but you might as well give it a shot.

     

    Matt

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (1)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points