Sample code for 30+ languages & platforms
AutoIt

XMP Array Property - Bag, Seq, or Alt

See more XMP Examples

How to insert or update an XMP array property (bag, seq, or alt).

Chilkat AutoIt Downloads

AutoIt
Local $bSuccess = False

;  This requires the Chilkat API to have been previously unlocked.
;  See Global Unlock Sample for sample code.

$oXmp = ObjCreate("Chilkat.Xmp")

;  Load a JPG or TIF image file.
;  Sample JPG's with XMP metadata may be found at:
;  http://www.chilkatsoft.com/testData/xmp/sample1.jpg
;  http://www.chilkatsoft.com/testData/xmp/sample2.jpg
;  http://www.chilkatsoft.com/testData/xmp/sample3.jpg
$bSuccess = $oXmp.LoadAppFile("sample1.jpg")
If ($bSuccess <> True) Then
    ConsoleWrite($oXmp.LastErrorText & @CRLF)
    Exit
EndIf

ConsoleWrite("Num embedded XMP docs: " & $oXmp.NumEmbedded & @CRLF)

;  Assuming there is at least one, get the 1st.
;  (There is typically never more than one, but theoretically it's possible.)
Local $oXml
$oXml = $oXmp.GetEmbedded(0)
If ($oXmp.LastMethodSuccess = True) Then

    ;  Create an object to hold one or more string values.
    $oSa = ObjCreate("Chilkat.StringArray")
    $bSuccess = $oSa.Append("value_1")
    $bSuccess = $oSa.Append("value_2")
    ;  ...

    $bSuccess = $oXmp.AddArray($oXml,"bag","Iptc4xmpCore:Chilkat",$oSa)
    If ($bSuccess <> True) Then
        ConsoleWrite($oXmp.LastErrorText & @CRLF)
    Else
        ;  Save the JPG.
        $bSuccess = $oXmp.SaveAppFile("modified.jpg")
        If ($bSuccess <> True) Then
            ConsoleWrite($oXmp.LastErrorText & @CRLF)
        EndIf

    EndIf

Else
    ConsoleWrite($oXmp.LastErrorText & @CRLF)
EndIf