Vlad,

You're just a few AppleScript lines away from solving your project.

The problem is that Finder's dictionary does *not* provide access to "modern" 
tags. So we have to code that with AS but we don't have to reinvent the wheel 
since Shane Stanley has already written *the* code that you can use to 
manipulate tags in AS.

I am not sure the link points at the canonical version, but that's the one I 
use for reference:

https://lists.apple.com/archives/applescript-users/2015/Jan/msg00193.html

Jean-Christophe 

> On Mar 14, 2020, at 23:44, Vlad Ghitulescu <[email protected]> wrote:
> 
> Hey!
> 
> What I've got so far:
> 
>       • I manage to extract the IPTC-keywords from the initial example:
> 
> <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 5.6.0">
>  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";>
>     <rdf:Description rdf:about=""
>         xmlns:dc="http://purl.org/dc/elements/1.1/";
>         xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/";
>         xmlns:xmp="http://ns.adobe.com/xap/1.0/";
>         xmlns:photomechanic="http://ns.camerabits.com/photomechanic/1.0/";
>      photoshop:DateCreated="2018-05-10T13:35:00.03"
>      xmp:CreateDate="2018-05-10T13:35:00.03"
>      xmp:Rating="0"
>      photomechanic:ColorClass="0"
>      photomechanic:Tagged="False"
>      photomechanic:Prefs="0:0:0:-00001"
>      photomechanic:PMVersion="PM6">
>      <dc:subject>
>         <rdf:Bag>
>          <rdf:li>Ben</rdf:li>
>          <rdf:li>Mina</rdf:li>
>          <rdf:li>Tom</rdf:li>
>          <rdf:li>Vlad</rdf:li>
>         </rdf:Bag>
>      </dc:subject>
>     </rdf:Description>
>  </rdf:RDF>
> </x:xmpmeta>
> 
> using BBEdit's "Process Line Containing…"-command, where I searched for
> 
>      <rdf:li>
> 
>       • I replaced (manually, not via a script etc.) then
>       • first
> 
>  <rdf:li>
> 
>       • and then
> 
> </rdf:li>
> 
> with nothing.
> 
> The result:
> 
> Ben
> Mina
> Tom
> Vlad
> 
> are the 4 IPTC-Keywords that I want to set as Finder-tags to the CR2 / JPG / 
> TIFF - file with the same name as the XMP-file.
> 
>       • I've found an Automator-action that can assign tags to files or 
> folders.
> <Bildschirmfoto 2020-03-14 um 15.39.50.png>
> 
> These are only a couple of pieces of the whole puzzle and right now I don't 
> have a clue how to "glue" them together :-(
> 
> Any help would be greatly appreciated.
> 
> Regards,
> Vlad
> 
> On 13 Mar 2020, at 13:44, Vlad Ghitulescu wrote:
> 
> I was inexact regarding file-names and -number:
> 
>       • the XMP-file and the photo-file have the same name AND
>       • there is most of the time more than one photo-file, because I shoot 
> in RAW (that’s CR2 for me, shooting Canon) and all of the edited versions are 
> JPG, once in a while TIFF.
> So for a given photo „PhotoName“ I have always at least two files
> 
> PhotoName.CR2 (the RAW-file)
> PhotoName.XMP (the metadata-file, I was hard-working enough to take care of 
> the metadata ;-)
> 
> and for the most of the photos there are even some other edited versions as
> 
> PhotoName.JPG
> PhotoName-1.JPG
> PhotoName-bw.JPG
> PhotoName.TIFF
> 
> The edited versions all begin with A but can have a) some data added to the 
> end of the file-name (as digits for various versions or -bw for black & 
> white) and b) some other file-extensions (JPG and once in while TIFF).
> 
> That make my dream-script a little more complicated:
> 
>       • take this photo-folder;
>       • read from the first XMP-file the IPTC-keywords;
>       • copy all of this IPTC-keywords as Finder-tags to all of the files 
> with the suffixes CR2, JPG or TIFF of which the file-name begins with the 
> same name as the XMP-file;
>       • loop within the photo-folder until there is no XMP-file anymore.
> I hope that now is more clearer.
> 
> Thanks in advance!
> 
> Regards,
> Vlad
> 
> On 13 Mar 2020, at 8:18, Vlad Ghitulescu wrote:
> 
> Hey!
> 
> This is a BBEdit-question, but I first need to give a little background to 
> it. :-)
> 
> As all photographers here already know, the metadata to the photos lives in a 
> suplimentary XMP-file.
> Here is a sample of a XMP-file for one of my photos, where I filled in the so 
> called IPTC-keywords in Photo Mechanic:
> 
> <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 5.6.0">
>  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";>
>     <rdf:Description rdf:about=""
>         xmlns:dc="http://purl.org/dc/elements/1.1/";
>         xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/";
>         xmlns:xmp="http://ns.adobe.com/xap/1.0/";
>         xmlns:photomechanic="http://ns.camerabits.com/photomechanic/1.0/";
>      photoshop:DateCreated="2018-05-10T13:35:00.03"
>      xmp:CreateDate="2018-05-10T13:35:00.03"
>      xmp:Rating="0"
>      photomechanic:ColorClass="0"
>      photomechanic:Tagged="False"
>      photomechanic:Prefs="0:0:0:-00001"
>      photomechanic:PMVersion="PM6">
>      <dc:subject>
>         <rdf:Bag>
>          <rdf:li>Ben</rdf:li>
>          <rdf:li>Mina</rdf:li>
>          <rdf:li>Tom</rdf:li>
>          <rdf:li>Vlad</rdf:li>
>         </rdf:Bag>
>      </dc:subject>
>     </rdf:Description>
>  </rdf:RDF>
> </x:xmpmeta>
> 
> The individual data is the creation-date:
> 
>      photoshop:DateCreated="2018-05-10T13:35:00.03"
>      xmp:CreateDate="2018-05-10T13:35:00.03"
> 
> and the IPTC-keywords:
> 
>          <rdf:li>Ben</rdf:li>
>          <rdf:li>Mina</rdf:li>
>          <rdf:li>Tom</rdf:li>
>          <rdf:li>Vlad</rdf:li>
> 
> Another background-information that probably all of you know: there is no 
> relation between the IPTC / XMP - keywords and the Finder / macOS - tags.
> 
> And this exactly is my problem.
> 
> I need to input somehow / somewhere the metadata to my photos, but I don't 
> want to make this twice in order to have this information present in the 
> IPTC-keywords AND in the Finder-tags as well.
> 
> This is not new at all: Google-ing about "copy IPTC-keywords into 
> Finder-tags" or viceversa I've found a lot but all of it involved in one step 
> or another the EXIFtool, a command line utility that reads and writes 
> photo-metadata… and this doesn't scale very well (I have A LOT of photos: 
> about 220,000 pics that are more than 2 TB big!) and it is slow, because the 
> EXIFtool have to read the metadata from the photo.
> 
> So my idea is to take care or the IPTC-keywords in Photo Mechanic (this would 
> create a XMP-file as the one above for every photo I have) and then - and 
> here comes BBEdit! :-) - somehow transfer the data from the XMP-file (that is 
> in the end only a text-file!) to the Finder-tags.
> 
> Now finally to my question (sorry for the length!): How could I
> 
>       • take each IPTC-keyword (delimited by the tag < rdf:li >, see above) 
> and
>       • write this IPTC-keyword into a Finder-tag
> for every photo in a folder?
> 
> Ideally I'd have a script, point it to a folder full of photos and BOOM!, 
> after this every photo would have the same Finder-tags as the IPTC-keywords!
> 
> Could you please help me with this?
> 
> Thanks in advance!
> 
> Regards,
> Vlad
> 
> -- 
> This is the BBEdit Talk public discussion group. If you have a feature 
> request or need technical support, please email "[email protected]" 
> rather than posting here. Follow @bbedit on Twitter: 
> https://twitter.com/bbedit
> --- You received this message because you are subscribed to the Google Groups 
> "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/bbedit/93FE2214-4BDD-4C41-952F-61C910E44C38%40Ghitulescu.de.
> 
> -- 
> This is the BBEdit Talk public discussion group. If you have a feature 
> request or need technical support, please email "[email protected]" 
> rather than posting here. Follow @bbedit on Twitter: 
> https://twitter.com/bbedit
> --- You received this message because you are subscribed to the Google Groups 
> "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/bbedit/E3AD63CE-D6D0-4FD0-A317-514C772BFBC9%40Ghitulescu.de.
> 
> 
> -- 
> This is the BBEdit Talk public discussion group. If you have a feature 
> request or need technical support, please email "[email protected]" 
> rather than posting here. Follow @bbedit on Twitter: 
> <https://twitter.com/bbedit>
> --- 
> You received this message because you are subscribed to the Google Groups 
> "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/bbedit/74E567C0-F5BE-48D8-A30F-9EEBEA2737C7%40Ghitulescu.de.

Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com @brandelune


-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "[email protected]" rather than 
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/85ED17EA-5E51-4CA7-AD1E-B1C557942702%40traduction-libre.org.

Reply via email to