Example: /XMP/Create XMP

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

/XMP/Create XMP


Required plugins for this example: MBS XMP Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /XMP/Create XMP

This example is the version from Sat, 2nd Apr 2021.

Project "Create XMP.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Const kXMP_PropValueIsArray = &h200
EventHandler Sub Open() Dim file As FolderItem = SpecialFolder.Desktop.Child("sample.png") // use XMPFilesMBS to open file dim flags as integer = XMPFilesMBS.kOpenForUpdate dim xf as new XMPFilesMBS(file, XMPFilesMBS.kUnknownFile, flags) // now read the metadata dim xmp as new XMPMetaMBS dim PacketInfo as XMPPacketInfoMBS dim xmppacket as string if xf.GetXMP(xmp, xmppacket, PacketInfo) then // read Else // we start with blank one end if // and dump to test file Dim outputfile As FolderItem = SpecialFolder.Desktop.Child("before.txt") Dim output As New MyXMPTextOutputMBS(outputfile) Call xmp.DumpObject(output) // here we add XMP value: xmp.AppendArrayItem ( xmp.kNS_XMP, "subject", kXMP_PropValueIsArray, "AAAA" ) // and dump to test file outputfile = SpecialFolder.Desktop.Child("after.txt") output = New MyXMPTextOutputMBS(outputfile) Call xmp.DumpObject(output) // update file If xf.CanPutXMP(xmp) Then xf.PutXMP(xmp) xf.CloseFile(XMPFilesMBS.kUpdateSafely) Else MsgBox "Can't update." End If End EventHandler
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
Class MyXMPTextOutputMBS Inherits XMPTextOutputMBS
EventHandler Function Output(text as string) As integer TextStream.Write text Return 0 // OK End EventHandler
Sub Constructor(file as FolderItem) self.file = file self.TextStream = TextOutputStream.Create(file) End Sub
Property TextStream As TextOutputStream
Property file As FolderItem
End Class
End Project

See also:

The items on this page are in the following plugins: MBS XMP Plugin.


💬 Ask a question or report a problem