Write Metadata using exiftool from Filemaker

I post this for 2 reasons. It took me some time and lots of help to get this working so in sharing maybe it will help someone else. Also maybe in someone looking at the script they can see a better way or suggest improvements.

I am kinda new to all of this so be kind if I am doing it the hard way

Hope it helps someone
Roger


– Use Exiftool to write metadata tags

– Set variables to null
set aScript to “”
set aScriptResult to “”
set aPath to “”
set nLength to “”
set nStart to “”

– Set variables to default values
set City to “Lexington”
set Country to “USA”
set Address to “3316 XXXXX Trail”
set PostalCode to “99999”
set Region to “Kentucky”
set WorkEmail to “XXXXX@gmail.com
set WorkTelephone to "(899) “999-99999”
set Creator to “WWW W. WWWWW”

– Move data from filemaker to variable
tell application “FileMaker Pro”
set qEvent to cell “RWellsImages::Event” of current record
set qWhen to cell “RWellsImages::When” of current record
set qWhere to cell “RWellsImages::Where” of current record
set qKeyWords to cell “RWellsImages::KeyWords” of current record
set qDescription to cell “RWellsImages::Description” of current record
set qPath to cell “RWellsImages::FilePath” of current record
set qDocumentType to cell “RWellsImages::DocumentType” of current record
end tell

– Move data to quoted form of data
set qEvent to quoted form of qEvent
set qWhen to quoted form of qWhen
set qWhere to quoted form of qWhere
set qKeyWords to quoted form of qKeyWords
set qDescription to quoted form of qDescription
set qDocumentType to quoted form of qDocumentType

– Parse out path from filemaker to use in exiftool
set nLength to length of qPath
set qPath to “/Volumes” & text 7 thru nLength of qPath
set qPath to quoted form of POSIX path of qPath

– Format script
set aScript to aScript & “exiftool -overwrite_original_in_place -Title="” & qEvent & “" -Location="” & qWhere & “" -Keywords="” & qKeyWords & “" -Description="” & qDescription & “" -Creator="” & Creator & “" -CreatorCity="” & City & “" -CreatorCountry="” & Country & “" -CreatorAddress="” & Address & “" -CreatorPostalCode="” & PostalCode & “" -CreatorRegion="” & Region & “" -CreatorWorkEmail="” & WorkEmail & “" -CreatorWorkTelephone="” & WorkTelephone & "" " & qPath

– Run script and put results into variable
set aScriptResult to do shell script aScript

– Display results
display dialog aScriptResult