Reverse Copy Ratings and Labels Script

Started by Aubrey, January 23, 2015, 12:51:03 PM

Previous topic - Next topic

Aubrey

I have been going through the script proposed by Ferdinand for reverse copy to Masters,
https://www.photools.com/community/index.php?topic=407.msg2187#msg2187

This originated from a discussion of categorizing DNG file discussion:
https://www.photools.com/community/index.php?topic=3708.msg24638#msg24638

I am about to attempt to modify the script and test it (not using my main database  ;D)

It is not clear how one can get the parameter names that are stored, for example where does one find that the image rating is stored in
img.Rating?

In fact I'm looking for where the category is stored, as it is the categories of an image that I would like to reverse copy. How can I find out this information?

Thanks,
Aubrey.

Ferdinand

My reverse propagation script is fairly simple, because ratings and labels are special cases.  That is, there are special scripting methods (img.rating & img.label) that enable you to read and write them without resorting to all the code you need to read and write other metadata.  So for anything else, you'll need slightly longer and more complex code.  For categories, you can look at my propagation script for V5.  That has code that copies categories from one file to another.

Mario

I suggest you check out the IMatch Scripting Help as well. Which has excessive treatments of the Category and Categories classes as well as the TagInfo, TagData, TagValue and TagValues classes you may need.

Or consider setting up reverse relations (DNG as the master, RAW as the version) and avoid any scripts. If this fits into your workflow.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Aubrey

My issue is that I want DNG as my master, and NEFs as my versions. (I know there have been suggestions to go the other way around and use proxies, but I don't want to do this). I usually set up categories immediately after I import the NEFs.

At some later time I will work on files in Lightroom and send back to Imatch for archiving as DNG file.

As Lightroom does not understand categories these do not get sent to Lightroom so of course they never get sent back with the DNG. Labels and Rating are passed back and forth.

So the only thing I need to do is to copy the Category from the NEF Version to the DNG Master

My current w.around is to make NEF master and propagate, then make the DNG master.

I'm going to look at Ferdinand's script for copying categories. If nothing else I'm learning another scripting language  8)

Aubrey.

Ferdinand

Actually, I've just had a look at that script, and realised that it may not be the best example to look at, even though the code to propagate the categories is well marked.  What that script does is have a list of categories to reverse propagate and so the code needs to loop through the categories that the source image for the copy is assigned to, test whether they're in that list, and if so then assign the target image to those categories.  This replicates what native file relations versioning does, since you have to indicate which categories to copy, although checking All is an option.

If you just want to copy all categories then the code to do what you want is simpler.  You just have a loop that loops over each category in the set of categories that the source file is assigned to, and assign the target to those categories.  You could get this from my script, by getting rid of all the lines that have the "allowed" variable in them, which gets rid of most lines.  Looking at one of Mario's sample scripts might be easier.

Aubrey

Ferdinand,
Thank you for taking the time to add your comments. Indeed I want to copy all categories, only replicate what I alreaady have in the version.

I'm on a steep learning curve, but it will be an interesting project.

Aubrey.

Ferdinand

What you need to do is find the line that says hitz.AddFile(r.File) and add this block of code before hand

                Set cat=img.Categories
                For Each k In cat
                        k.AssignFile(imj)
                Next k
                Set cat=Nothing


You'll also need to add these two lines at the top with the other Dim statements:

Dim cat As Categories
Dim k As Category


If you want to copy the cats to all other versions, you'll need a similar block of code before hitz.AddFile(s.File)

                    Set cat=img.Categories
                    For Each k In cat
                            k.AssignFile(imjj)
                    Next k
                    Set cat=Nothing



Now of course if you want to add an option in the dialog box to turn this on and off, then you'll have a little more work to do.  I'll leave that as a project.