Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


InDesign Library - Block Addition of Frames

Explorer ,
Oct 28, 2021 Oct 28, 2021

Copy link to clipboard

Copied

Hi,

 

I want to block addition of frames to InDesign Library. (*.indl).

 

I am observing kSnippetBasedCatalogBoss and catpure the command kLibraryAddItemCmdBoss with message kBeforeDoMessageBoss.

 

From kLibraryAddItemCmdBoss, I am able to identify which frames are being added by the user and I can decide whether to block the addition of frames or not.

 

From Observer, I set ErrorUtils::PMSetGlobalErrorCode(kCancel) when kLibraryAddItemCmdBoss &&  kBeforeDoMessageBoss command is executed.

 

The above method works and it doesn't allow frame to be added in Library.

 

But then it display the following message as shown in the screenshot -

 

rahulrastogi2_0-1635428302978.png

 

I don't want any message to be displayed.

 

I also tried the following -

 

1. With kLibraryAddItemCmdBoss, we have ICopyCmdData interface, from where I get IDataExchangeHandler and call IDataExchangeHandler->Clear().

 

InDesign still displays the error message.

 

2. I added my own error ErrorStringService and passed my own error in ErrorUtils::PMSetGlobalErrorCode(kMyErrorCode) but then InDesign Crashes.

 

Am I observing correct boss class kSnippetBasedCatalogBoss and obsering right command kLibraryAddItemCmdBoss ?

 

Can anyone help me on this ?

 

Regards,

Rahul Rastogi

 

TOPICS
SDK

Views

33

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
community guidelines

correct answers 1 Correct answer

Explorer , Oct 29, 2021 Oct 29, 2021
Found the solution -  if(::GetClass(iCommand) == kLibraryAddItemCmdBoss && theChange == kBeforeDoMessageBoss) {InterfacePtr<ILibraryCmdData> iLibraryCmdData(iCommand, IID_ILIBRARYCMDDATA); if(!iLibraryCmdData) break;iDestLibrary = iLibraryCmdData->GetDestLibrary(); } else if(::GetClass(iCommand) == kLibraryAddItemCmdBoss && theChange == kAfterDoMessageBoss) {InterfacePtr<ILibraryCmdData> iLibraryCmdData(iCommand, IID_ILIBRARYCMDDATA); if(!iLibraryCmdData) break;AssetIDList assetIDList = iLibrary...

Likes

Translate

Translate
Explorer ,
Oct 29, 2021 Oct 29, 2021

Copy link to clipboard

Copied

LATEST

Found the solution -

 

 if(::GetClass(iCommand) == kLibraryAddItemCmdBoss && theChange == kBeforeDoMessageBoss)
{

InterfacePtr<ILibraryCmdData> iLibraryCmdData(iCommand, IID_ILIBRARYCMDDATA);
if(!iLibraryCmdData)
break;

iDestLibrary = iLibraryCmdData->GetDestLibrary();
}
else if(::GetClass(iCommand) == kLibraryAddItemCmdBoss && theChange == kAfterDoMessageBoss)
{

InterfacePtr<ILibraryCmdData> iLibraryCmdData(iCommand, IID_ILIBRARYCMDDATA);
if(!iLibraryCmdData)
break;

AssetIDList assetIDList = iLibraryCmdData->GetAssetList();

Utils<ILibraryCmdUtils>()->ProcessLibraryDeleteItemsCmd(assetIDList, iDestLibrary);


// set the global error to kSuccess otherwise InDesign displays message "disk is full".
ErrorUtils::PMSetGlobalErrorCode(kSuccess);

}

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
community guidelines