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

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

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
Graf_Wetter
 
Posts: 45
Joined: Thu Aug 25, 2011 7:18 am

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

a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

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
Graf_Wetter
 
Posts: 45
Joined: Thu Aug 25, 2011 7:18 am


Return to Support