Highlighted

Modifying specific metadata property on a document

Community Beginner ,
Sep 29, 2020

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

TOPICS
SDK

Views

35

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Modifying specific metadata property on a document

Community Beginner ,
Sep 29, 2020

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

TOPICS
SDK

Views

36

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sep 29, 2020 0
Advisor ,
Sep 30, 2020

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 30, 2020 0