Copy link to clipboard
Copied
Hi,
I am writing a custom plugin. I am setting custom metadata on a document using kAppendMetaDataCmdBoss. Now I want to be able to modify a particular property on the metadata. For that I am using set function of IMetaDataAccess and then saving it.The steps are :
1) I get the front document using Utils<ILayoutUIUtils>()->GetFrontDocument();
2) Modify property using IMetaDataAccess->Set
3) Save document using : Utils<IDocumentCommands>()->Save(::GetUIDRef(theFrontDoc));
The metadata is correctly modified for the particular property. But When the document is closed it causes indesign to crash.
It this correct way of modifying particular property in metadata?
Thanks
Copy link to clipboard
Copied
Like most modifications, invoke your Set() … thru a command - write an own command for that.
For an example, see kSetAdobeMediaMgmtMDCmdBoss with its IID_ISETADOBEMEDIAMGMTMDCMDDATA .
Alternatively copy the entire metadata to a stream, modify it on a local copy, then write back the entire stream - again with an own command. Apparently kSetMetaXAPCmdBoss uses that approach but IID_ICHARSTRINGDATA is undocumented.