Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
Modify XMP Array Property (Bag, Seq, or Alt)Visual Basic example program to modify an XMP array property by removing some values and adding some others. ' Modify an array property.
' Create an instance of the XMP ActiveX and unlock it.
Dim xmp As New ChilkatXmp
success = xmp.UnlockComponent("anything for 30 day trial")
If (success = 0) Then
MsgBox "Failed to unlock"
Exit Sub
End If
' Load a JPG file.
success = xmp.LoadAppFile("IndependantPhotographer-Example.jpg")
If (success = 0) Then
MsgBox xmp.LastErrorText
Exit Sub
End If
' Get the 1st (and only) XMP in this JPG.
Dim xml As ChilkatXml
Set xml = xmp.GetEmbedded(0)
If (xml Is Nothing) Then
MsgBox xmp.LastErrorText
Exit Sub
End If
' Get the "dc:subject" array items.
Dim sa As CkStringArray
Set sa = xmp.GetArray(xml, "dc:subject")
If (sa Is Nothing) Then
MsgBox "dc:subject property not found"
Exit Sub
End If
' Prevent duplicates in the string array object by
' setting the Unique property
sa.Unique = 1
' Remove a few items we don't want...
sa.Remove "age"
sa.Remove "beach"
sa.Remove "nature"
' Add some...
sa.Append "sand"
sa.Append "ocean"
' AddArray is a "replace" operation if the property already exists.
xmp.AddArray xml, "bag", "dc:subject", sa
' Save the XML to review if desired.
xml.SaveXml "out.xml"
' Save the JPG with the dc:subject modified.
xmp.SaveAppFile "out.jpg"
|
© 2000-2012 Chilkat Software, Inc. All Rights Reserved.