Page 1 of 1

xmp-tags to pdf-files, help needed setting a variable

PostPosted: Thu Apr 11, 2013 10:37 am
by Graf_Wetter
Hi,
as a next step of this topic http://www.noodlesoft.com/forums/viewtopic.php?f=4&t=2021
I´m am now able to do it the other way around and set xmp-tags to a pdf-file by parsing an xml-file.
I use exiftool within an applescript that looks like this.
Code: Select all
set pdffile to quoted form of (POSIX path of theFile) as string

do shell script "exiftool -overwrite_original -TagsFromFile " & "/Volumes/Produktion/Druckdaten_Eingang/36503/36503.xml" & " -XMP:all " & pdffile

This first version of the script works, but what I need now is a variable for the xml-file so that the script can be changed to this
Code: Select all
do shell script "exiftool -overwrite_original -TagsFromFile " & xmlfile & " -XMP:all " & pdffile

The xml is located in the same folder as the triggered pdf ("thefile"), here .../36503/
The parent folders name is always five numbers but changes from job to job.
So maybe the variable could be built like this:
set parent to Parentfolder of thefile
set xmlfile to parent & /*.xml

[*] = wildcard for the xml´s name.

Can anyone help me transfering this to working code ?
Thanks a lot ...

Graf_Wetter

Re: xmp-tags to pdf-files, help needed setting a variable

PostPosted: Thu Apr 11, 2013 1:37 pm
by a_freyer
Is it always the name of the folder?

Do something like this:
Code: Select all
tell application "Finder" to set xmlfile to name of folder of file theFile

do shell script "exiftool -overwrite_original -TagsFromFile /Volumes/Produktion/Druckdaten_Eingang/" & xmlfile &"/" & xmlfile & ".xml -XMP:all " & pdffile


Re: xmp-tags to pdf-files, help needed setting a variable

PostPosted: Thu Apr 11, 2013 3:52 pm
by Graf_Wetter
the xml file will always have the 5 digits number similar to its parent folder.
But when I think again about the parent folder, there might be situation where
the folder´s name has the 5-digits number plus a text-addtion.
So sometimes the path could be:
Volumes/Produktion/Druckdaten_Eingang/36503_someindividualtext/36503.xml