Keyword counter

Started by loweskid, October 19, 2019, 07:56:59 PM

Previous topic - Next topic

loweskid

Would it be possible to have a counter in the metadata panel to display the number of individual keywords, as well as (or instead of) the character count?  The photo agency Alamy have a limit of fifty keywords, so a keyword counter would be more useful (for me) than the character count in this particular field.

Not important but would be nice to have, if easily done.

Mario

The Metadata Panel handles all metadata in your database. Keywords have no special meaning for it. And you should use the Keyword Panel to input keywords, not the MD panel. Just in case.

Why don't you just display this information in the File Window (make your own layout with a custom template and a variable)?

This variable should do:

{File.MD.XMP::dc\subject\Subject\0|count:true}

Or open the Var Toy app in a panel and just use the above variable.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

loweskid

Quote from: Mario on October 19, 2019, 08:07:24 PM

Why don't you just display this information in the File Window (make your own layout with a custom template and a variable)?

This variable should do:

{File.MD.XMP::dc\subject\Subject\0|count:true}

Now I feel stupid - I should have thought of this.  Thanks once again.

Mario

No need to feel stupid. IMatch is huge and no user (including myself!) knows all about it.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

graham1

This is really helpful, but I cannot get it to work quite how I want it.

I put this variable into the first thumbnail footer, and it shows the number of keywords - excellent. 

Then I tried to put the character count for the hierarchical keywords and for the Description in further thumbnail footers, so that all this information is visible in each thumbnail. Replacing subject by description in the variable gives only the number 1, and replacing subject by hierarchical keywords does not work at all.

I am not a programmer at all. I suspect that there are variables that do what I am trying to do, but I cannot find them.  If I could be pointed in the direction of the variables to use and their syntax for the respective character counts, to add to the thumbnail footers, I would be immensely grateful. 

Graham

Mario

It is always helpful to include the exact variable you are using in your post.

Variables are case-sensitive and the exact syntax is important.

Tip: Use the VarToy app to quickly select and test variables.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

graham1

QuoteTip: Use the VarToy app to quickly select and test variables.
Yes, that is exactly what I have been doing, but I cannot find the correct variables, even using the browse function for variables and tags in Var Toy.

Let us assume that a particular image has 100 keywords and 1000 characters, and that the Description has 150 characters.

What I am trying to do is to have the first three thumbnail footers for each image return respectively (1) "Keywords: 100", (2) "Characters: 1000", (3) "Description: 150".

"Keywords: {File.MD.XMP::dc\subject\Subject\0|count:true}" returns "Keywords: 100".  This is exactly what I want for (1).  Also "Keywords: {Application.Variables.Keywords}" returns "Keywords: 100", so I could use either for (1).

But that is as far as I can get.  I cannot find a variable that will return the number of keyword characters, as opposed to words, for either (2) or (3). 

If I use "Description: {File.MD.XMP::dc\description\Description\0|count:true}", this returns "Description: 1", not the number of characters I want for (3).  If I omit the "|count:true", then the full text of the Description is returned, which is not what I want for the thumbnail.

The numbers I want for (2) and (3) show up in the Metadata Panel when I click on Hierarchical Keywords or Description respectively.  Since the data is returned in the Metadata Panel, I feel sure that there will be a corresponding variable which will allow the same information to be displayed in thumbnail footers.

So, I have looked, I have tried, I have used Var Toy, but I cannot find what I need.  I am not a programmer, there is only so far I can go by guesswork, trying out variations of char, character etc. in the hope that something might work.  Please therefore could you let me know the two variables and syntax I need to achieve (2) and (3) as described above.

Thank you.

Graham

Jingo

#7
I think you are probably looking for something like: {File.MD.description|length}  or {File.MD.XMP::dc\description\Description\0|length}

Check out the help section: https://www.photools.com/help/imatch/#var_basics.htm?dl=h-31  for more good formatting functions... ENJOY!


sinus

I think, the variables of Jingo will do what you want.
Best wishes from Switzerland! :-)
Markus

Mario

Quote from: Jingo on November 20, 2019, 02:20:23 AM
I think you are probably looking for something like: {File.MD.description|length}  or {File.MD.XMP::dc\description\Description\0|length}

Check out the help section: https://www.photools.com/help/imatch/#var_basics.htm?dl=h-31  for more good formatting functions... ENJOY!

That would also be by guess. count counts repeatable tags (like keywords) and length counts the number of characters in a tag (like in a description).
Note that the metadata panel also shows the number of characters in the currently active (selected) tag.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

graham1

Thank you sinus, Jingo and Mario for your replies.

I am nearly there.  {File.MD.XMP::dc\subject\Subject\0|count:true} returns the number of keywords and {File.MD.XMP::dc\subject\Subject\0|length} returns the number of characters.  This is very helpful, and I want both these pieces of information in my thumbnail footers.

But the number of characters returned by this variable is not the same as the total number (total length of field) returned in the Metadata Panel, which includes the number of separators as well.  I would like to be able to display this total figure as well in a thumbnail footer field.

Take, for example, the keywords: "Africa, African, ape, beast, creature, fauna, animal".  The Metadata Panel returns 52 characters because it includes the separators, while a count of the variable returns 46, being the number of actual characters.

Right clicking the Hierarchical Keywords field in the Metadata Panel allows copying as a variable, but the output of the variable is still the number of characters, not the total field length shown in the Metadata Panel.

Were the variables able to do maths, the formula for a variable to return the same number as that shown in the Metadata panel might be something like ={File.MD.XMP::dc\subject\Subject\0|length}+{File.MD.XMP::dc\subject\Subject\0|count:true}-1.  But the output shows not as 52, but as 46+7-1 [the formula would give an incorrect number if there were only one keyword, because there is no trailing separator to deduct from the overall count, but I can live with that!]

Can the variables be made to do maths in this way?  I cannot find this in any of the help pages.  Or is there another alternative that will return 52, rather than 46+7-1, so that the output matches the number shown in the Metadata Panel?  {File.MD.description|length} returns the same total number of characters, including punctuation and spaces, as is shown for Description in the Metadata Panel, and I am rather puzzled that I cannot achieve the same result for the Hierarchical Keywords word count as it shows up in the Metadata Panel.

Thank you.

Graham


Mario

You can use the math functions available for variables to add/subtract etc.
For example:

{File.MD.XMP::dc\subject\Subject\0|count:true}
{File.MD.XMP::dc\subject\Subject\0|length}
{File.MD.XMP::dc\subject\Subject\0|length;cast:int;math:add,{File.MD.XMP::dc\subject\Subject\0|count:true}}


Which gives (for example)

4
67
71

We just add one to the length for each keyword.

-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

graham1

Fantastic, thank you Mario.  Works like a charm.

Graham

Mario

Quote from: graham1 on November 20, 2019, 11:53:34 AM
Fantastic, thank you Mario.  Works like a charm.

Graham
Excellent. Where there is IMatch, there is (usually) a way.

Spread the word! Let others know about IMatch. In forums where you participate. Facebook. Twitter. Instagram...
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook