Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
IAutoFlowCmdData->Set(UID page, UID frameList, UIDRef &parent....
Are you passing the 2nd parameter correct - I hope you are not passing Frame's UID (boxUID) but instead passing the UID of kFrameListBoss.
InterfacePtr<IGraphicFrameData> iGraphicFrameData(frameUIDRef, UseDefaultIID());
InterfacePtr<IMultiColumnTextFrame> imcf(iGraphicFrameData->QueryMCTextFrame());
UID frameListUID = imcf->GetFrameListUID();
pass the above frameListUID.
- Rahul Rastogi
Adobe InDesign C++ Plugins Solution Architect
Copy link to clipboard
Copied
I don't know why but this peace of code doesn't work, when I try to execute command it goes in error.
Probably one of the 4 parameters that I pass to the "set" is wrong but I don't understand what it could be.
Here the code in case anyone wants to use it
ErrorCode function(UIDRef group, PMPoint attachPoint)
{
/// Page
InterfacePtr<IPageList> pageList(DOCUMENT, UseDefaultIID());
UID UIDPage = pageList->GetNthPageUID(pageList->GetPageCount()-1);
/// How i get the frameList
InterfacePtr<IGraphicFrameData> graphicFrameData(GetNthPageItem(group, 0), UseDefaultIID());
InterfacePtr<IMultiColumnTextFrame> multiColumnTextFrame(graphicFrameData->QueryMCTextFrame());
UID UIDFrameList = multiColumnTextFrame->GetFrameListUID();
/// Layer
InterfacePtr<IHierarchy> hierarchy(graphicFrameData, UseDefaultIID());
InterfacePtr<ISpreadLayer> spreadLayer(DATABASE, hierarchy->GetLayerUID(), UseDefaultIID());
UIDRef UIDRefLayer(DATABASE, spreadLayer->GetDocLayerUID());
/// Autoflow Command
InterfacePtr<ICommand> autoFlowCmd(CmdUtils::CreateCommand(kAutoFlowCmdBoss));
InterfacePtr<IAutoFlowCmdData> autoFlowCmdData(autoFlowCmd, UseDefaultIID());
autoFlowCmdData->Set(UIDPage, UIDFrameList, UIDRefLayer, attachPoint);
/// Execute the command
return CmdUtils::ProcessCommand(autoFlowCmd);
}
Copy link to clipboard
Copied
I'm sure I'm missing something but I don't understand what
Copy link to clipboard
Copied
For the 3rd Paremter - it expects kSpreadLayerBoss and not kDocumentLayerBoss.
You should be passing iFrameHierarchy->GetLayerUID() itself.
Copy link to clipboard
Copied
Hi @Rahul_Rastogi, thanks for the reply.
I've already try this solution but it doesn't work, so maybe this was a problem, but evidentelly not the only one.
However, looking at the data interface of the command, I noticed an interesting thing.
I'm probably passing a wrong FrameList to the interface, in fact, as you will see from the image below, everything concerning the FrameList is either empty or goes wrong.
Stefano
Copy link to clipboard
Copied
This requires investigation.
I don't have the InDesign Debug build installed otherwise we need to know the following -
From Debug build -
1. Capture command kAutoFlowCmdBoss
2. Do auto flow manually in InDesign and capture the command kAutoFlowCmdBoss
3. Check the contents of the interface IAutoFlowCmdData, IAutoFlowOversetText, ICommand->GetItemList.
Based on above findings we can then conclude what are the exact correct parameters the command is expecting.
Copy link to clipboard
Copied
Thanks for reply @Rahul_Rastogi,
I think this method is perfect and can save me a lot of time because, when command are not enogh documented, I usually fill interface and hope that it can works, how i'm doing now, and i ofted lose a lot of time doing this.
If you could tell me how I can capture a command you would be doing me a really big favor because I don't have a clue how to do it, I think I should use InDesign Debug, right?
Stefano
Copy link to clipboard
Copied
Hi @Stefano5C37 ,
There are multiple things that we need to check -
1. With InDesign Debug Build - Validate that "kAutoFlowCmdBoss" is the actual command that gets executed when we manually autoflow the content.
a. It may be possible this is not the real command but instead a child command. If that the case the parent command is the right command for AutoFlow.
b. This can only be validated using InDesign Debug Build without writing any code.
2. To Capture command and check the values of interfaces can be done using InDesign Release build itself. (InDesign Debug build is not required). This can be done in 2 ways -
a. Add document observer and with the help of information from Point No. 1, we observe the right interfaces and commands. We will get a callback and we can investigate.
OR
b. Add Command Interceptor - This is should not be used for production as it is too expensive to get call. We will get callback for each and every command that InDesign executes.
For Command Interceptor Implementation, you can refer -
Copy link to clipboard
Copied
Being a newbie, I anticipate that I have never performed such operations so be patient if I write things that are obvious or if I don't understand at the first try.
As for point 1, I'll explain what I did.
1) I opened InDesign Debug
2) I enabled Test > TRACE > Command Log
3) I enabled Test > TRACE > Echo to debug Windows
4) I opened <sdk>/devtools/DebugWindows.app
5) I run AutoFlow manually
6) This is the result on DebugWindows
Doing command Autoflow Text (kAutoFlowCmdBoss) this=0x9c84de20 uid[0]=0000 RegularUndo
Doing command Place Item (kPlacePICmdBoss) this=0x62e06880 uid[0]=29434 RegularUndo
Doing command Move Item (kCompoundSequenceCmdBoss) this=0x7eb39ff0 uid[0]=0000 RegularUndo
Doing command Move Item (kMoveAbsoluteCmdBoss) this=0x9c1a2180 uid[0]=29434 RegularUndo
Doing command Item XP Changed (kXPItemXPChangedCmdBoss) this=0x76da8cd0 uid[0]=29434 AutoUndoWithPrevious
Doing command Item XP Changed (kXPItemXPChangedCmdBoss) this=0x7fee1da0 uid[0]=29434 AutoUndoWithPrevious
Doing command Resize (kSetBoundingBoxCmdBoss) this=0x9b26c290 uid[0]=29434 RegularUndo
Doing command Item XP Changed (kXPItemXPChangedCmdBoss) this=0xa0387850 uid[0]=29434 AutoUndoWithPrevious
Doing command Item XP Changed (kXPItemXPChangedCmdBoss) this=0x64ece3d0 uid[0]=29434 AutoUndoWithPrevious
Doing command Modify Frame Options (kAddPageItemAdornmentCmdBoss) this=0xa03a8700 uid[0]=29434 AutoUndoWithPrevious
Doing command Item XP Changed (kXPItemXPChangedCmdBoss) this=0x9c76d240 uid[0]=29434 AutoUndoWithPrevious
Doing command Clear Loaded Place Cursor (kClearPlaceGunCmdBoss) this=0x7eb39ff0 uid[0]=0000 RegularUndo
Doing command (kPrivateRecomposeThruFrameCmdBoss) this=0x9b26b610 uid[0]=0000 RegularUndo
Doing command Modify Column Options (kChangeNumberOfColumnsCmdBoss) this=0x8c25c610 uid[0]=29434 AutoUndoWithPrevious
Doing command Resize (kSetBoundingBoxCmdBoss) this=0x63354830 uid[0]=29435 AutoUndoWithPrevious
Doing command Item XP Changed (kXPItemXPChangedCmdBoss) this=0x636adb50 uid[0]=28695 AutoUndoWithPrevious
Doing command Item XP Changed (kXPItemXPChangedCmdBoss) this=0x636adb50 uid[0]=29434 AutoUndoWithPrevious
Doing command Insert Spreads (kNewSpreadCmdBoss) this=0x636adb50 uid[0]=0000 RegularUndo
Doing command (kPrivateInsertSpreadCmdBoss) this=0x594dad70 uid[0]=0000 RegularUndo
Doing command (kAddDefaultLayersCmdBoss) this=0x7eb39ff0 uid[0]=29441 RegularUndo
Doing command (kPrivateNewPageCmdBoss) this=0x8e761bf0 uid[0]=0000 RegularUndo
Doing command (kPrivateInsertPagesInSpreadCmdBoss) this=0xa033c480 uid[0]=0000 RegularUndo
Doing command Apply Master Pages (kApplyMasterSpreadCmdBoss) this=0x64ece3d0 uid[0]=29456 RegularUndo
Doing command (kPrivateApplyMasterSpreadCmdBoss) this=0x9b293400 uid[0]=29456 RegularUndo
Doing command (kCompoundSequenceCmdBoss) this=0x9b7d7700 uid[0]=0000 RegularUndo
Doing command (kSetPageMarginsValidCmdBoss) this=0x9b779ef0 uid[0]=29456 RegularUndo
Doing command (kSetPageColumnsValidCmdBoss) this=0x9b71e290 uid[0]=29456 RegularUndo
Doing command Apply Page Grid Settings (kSetCJKLayoutGridDataCmdBoss) this=0x9b24f340 uid[0]=29456 RegularUndo
Doing command Set Binding Location (kSetBindingLocationCmdBoss) this=0x7a6c84c0 uid[0]=29441 RegularUndo
Doing command (kAdjustSpreadTransformCmdBoss) this=0x7a680400 uid[0]=29441 RegularUndo
Doing command Create Text Frame (kCreateMultiColumnItemCmdBoss) this=0xa277f810 uid[0]=0000 RegularUndo
Doing command Add New Item (kNewPageItemCmdBoss) this=0xa2792d00 uid[0]=0000 RegularUndo
Doing command Apply Object Style (kApplyObjectStyleCmdBoss) this=0xa27ac1d0 uid[0]=29457 RegularUndo
Doing command Modify Frame Options (kAddPageItemAdornmentCmdBoss) this=0xa27b0f90 uid[0]=29457 RegularUndo
Doing command Modify Frame Options (kAddPageItemAdornmentCmdBoss) this=0xa27ac1d0 uid[0]=29457 RegularUndo
Doing command Set Object Export Options (kSetObjectExportOptionsCmdBoss) this=0xa27afcb0 uid[0]=29457 AutoUndoWithPrevious
Doing command Add Path Points (kAddSplinePointsCmdBoss) this=0xa27ac1d0 uid[0]=29457 RegularUndo
Doing command Close Path (kClosePathCmdBoss) this=0xa278eab0 uid[0]=29457 RegularUndo
Doing command Set Item Matrix (kSetPMMatrixCmdBoss) this=0xa27c0a60 uid[0]=29457 RegularUndo
Doing command Add to hierarchy (kAddToHierarchyCmdBoss) this=0xa27ac1d0 uid[0]=29457 RegularUndo
Doing command (kSetGraphicFrameDataCmdBoss) this=0xa27c0850 uid[0]=29457 RegularUndo
Doing command Add New Item (kNewPageItemCmdBoss) this=0xa278eab0 uid[0]=0000 RegularUndo
Doing command Add to hierarchy (kAddToHierarchyCmdBoss) this=0x75280320 uid[0]=29458 RegularUndo
Doing command Modify Frame Options (kAddPageItemAdornmentCmdBoss) this=0x9a93bcd0 uid[0]=29458 RegularUndo
Doing command Create Text Frame (kNewFrameCmdBoss) this=0x9ac410b0 uid[0]=0000 AutoUndoWithPrevious
Doing command Add New Item (kNewPageItemCmdBoss) this=0x9a90ad90 uid[0]=0000 AutoUndoWithPrevious
Doing command Add to hierarchy (kAddToHierarchyCmdBoss) this=0x74dd7a20 uid[0]=29459 AutoUndoWithPrevious
Doing command (kAddFrameCmdBoss) this=0x9a96ac50 uid[0]=0000 AutoUndoWithPrevious
Doing command Modify Frame Options (kAddPageItemAdornmentCmdBoss) this=0x9a96ac50 uid[0]=29459 RegularUndo
Doing command Set Frame Grid Character Count Options (kSetCJKCharCountOptionsCmdBoss) this=0x75280320 uid[0]=29458 RegularUndo
Doing command Make Adornment Visible (kSetAdornmentVisibilityCmdBoss) this=0x9a93bcd0 uid[0]=29458 RegularUndo
Doing command (kPrivateRecomposeThruFrameCmdBoss) this=0x7527faf0 uid[0]=0000 RegularUndo
Doing command New Text Inset (kNewInsetPageItemCmdBoss) this=0x75281db0 uid[0]=29457 AutoUndoWithPrevious
Doing command Add New Item (kNewPageItemCmdBoss) this=0x9a95acb0 uid[0]=0000 AutoUndoWithPrevious
Doing command Modify Frame Options (kAddPageItemHandleAdornmentCmdBoss) this=0x9a96f4f0 uid[0]=29457 AutoUndoWithPrevious
Doing command Set Item Matrix (kSetPMMatrixCmdBoss) this=0x752825e0 uid[0]=29458 AutoUndoWithPrevious
Doing command (kAdjustSpreadTransformCmdBoss) this=0x75281db0 uid[0]=0000 AutoUndoWithPrevious
Doing command Item XP Changed (kXPItemXPChangedCmdBoss) this=0x7e70bda0 uid[0]=29434 AutoUndoWithPrevious
Doing command Item XP Changed (kXPItemXPChangedCmdBoss) this=0x7e70bda0 uid[0]=29457 AutoUndoWithPrevious
Doing command Insert Spreads (kNewSpreadCmdBoss) this=0x7e70bda0 uid[0]=0000 RegularUndo
Doing command (kPrivateInsertSpreadCmdBoss) this=0xa754c120 uid[0]=0000 RegularUndo
Doing command (kAddDefaultLayersCmdBoss) this=0x9a944460 uid[0]=29462 RegularUndo
Doing command (kPrivateNewPageCmdBoss) this=0x8c584bc0 uid[0]=0000 RegularUndo
Doing command (kPrivateInsertPagesInSpreadCmdBoss) this=0x8c5572c0 uid[0]=0000 RegularUndo
Doing command Apply Master Pages (kApplyMasterSpreadCmdBoss) this=0x9a9287e0 uid[0]=29477 RegularUndo
Doing command (kPrivateApplyMasterSpreadCmdBoss) this=0x9c26b3d0 uid[0]=29477 RegularUndo
Doing command (kCompoundSequenceCmdBoss) this=0x9b26b610 uid[0]=0000 RegularUndo
Doing command (kSetPageMarginsValidCmdBoss) this=0x9b29cac0 uid[0]=29477 RegularUndo
Doing command (kSetPageColumnsValidCmdBoss) this=0x9b23cb80 uid[0]=29477 RegularUndo
Doing command Apply Page Grid Settings (kSetCJKLayoutGridDataCmdBoss) this=0x9b2b10d0 uid[0]=29477 RegularUndo
Doing command Set Binding Location (kSetBindingLocationCmdBoss) this=0x61c6e0d0 uid[0]=29462 RegularUndo
Doing command (kAdjustSpreadTransformCmdBoss) this=0x9b2b10d0 uid[0]=29462 RegularUndo
Doing command Create Text Frame (kCreateMultiColumnItemCmdBoss) this=0x9b2b10d0 uid[0]=0000 RegularUndo
Doing command Add New Item (kNewPageItemCmdBoss) this=0x9b59e150 uid[0]=0000 RegularUndo
Doing command Apply Object Style (kApplyObjectStyleCmdBoss) this=0x9b5c3f80 uid[0]=29478 RegularUndo
Doing command Modify Frame Options (kAddPageItemAdornmentCmdBoss) this=0x9b5c67f0 uid[0]=29478 RegularUndo
Doing command Modify Frame Options (kAddPageItemAdornmentCmdBoss) this=0x9b5c3f80 uid[0]=29478 RegularUndo
Doing command Set Object Export Options (kSetObjectExportOptionsCmdBoss) this=0x9b587a40 uid[0]=29478 AutoUndoWithPrevious
Doing command Add Path Points (kAddSplinePointsCmdBoss) this=0x9b5c3f80 uid[0]=29478 RegularUndo
Doing command Close Path (kClosePathCmdBoss) this=0x9b59e150 uid[0]=29478 RegularUndo
Doing command Set Item Matrix (kSetPMMatrixCmdBoss) this=0x9b5e4b90 uid[0]=29478 RegularUndo
Doing command Add to hierarchy (kAddToHierarchyCmdBoss) this=0x9b5c3f80 uid[0]=29478 RegularUndo
Doing command (kSetGraphicFrameDataCmdBoss) this=0x9b5e4b90 uid[0]=29478 RegularUndo
Doing command Add New Item (kNewPageItemCmdBoss) this=0x9b5dc120 uid[0]=0000 RegularUndo
Doing command Add to hierarchy (kAddToHierarchyCmdBoss) this=0x7dd1d960 uid[0]=29479 RegularUndo
Doing command Modify Frame Options (kAddPageItemAdornmentCmdBoss) this=0x9c2eb0d0 uid[0]=29479 RegularUndo
Doing command Create Text Frame (kNewFrameCmdBoss) this=0x90870c90 uid[0]=0000 AutoUndoWithPrevious
Doing command Add New Item (kNewPageItemCmdBoss) this=0x9c26a240 uid[0]=0000 AutoUndoWithPrevious
Doing command Add to hierarchy (kAddToHierarchyCmdBoss) this=0x9ba51ab0 uid[0]=29480 AutoUndoWithPrevious
Doing command (kAddFrameCmdBoss) this=0x9ba40610 uid[0]=0000 AutoUndoWithPrevious
Doing command Modify Frame Options (kAddPageItemAdornmentCmdBoss) this=0x9ba1f890 uid[0]=29480 RegularUndo
Doing command Set Frame Grid Character Count Options (kSetCJKCharCountOptionsCmdBoss) this=0x7dd1d960 uid[0]=29479 RegularUndo
Doing command Make Adornment Visible (kSetAdornmentVisibilityCmdBoss) this=0x9ba1f890 uid[0]=29479 RegularUndo
Doing command (kPrivateRecomposeThruFrameCmdBoss) this=0x7dbf8a40 uid[0]=0000 RegularUndo
Doing command New Text Inset (kNewInsetPageItemCmdBoss) this=0x7a6879b0 uid[0]=29478 AutoUndoWithPrevious
Doing command Add New Item (kNewPageItemCmdBoss) this=0x9baf2af0 uid[0]=0000 AutoUndoWithPrevious
Doing command Modify Frame Options (kAddPageItemHandleAdornmentCmdBoss) this=0x665e31d0 uid[0]=29478 AutoUndoWithPrevious
Doing command Set Item Matrix (kSetPMMatrixCmdBoss) this=0x8c3ec3b0 uid[0]=29479 AutoUndoWithPrevious
Doing command (kAdjustSpreadTransformCmdBoss) this=0x7e008080 uid[0]=0000 AutoUndoWithPrevious
Doing command Item XP Changed (kXPItemXPChangedCmdBoss) this=0x75c0d430 uid[0]=29457 AutoUndoWithPrevious
Doing command Item XP Changed (kXPItemXPChangedCmdBoss) this=0xa52c2bf0 uid[0]=29478 AutoUndoWithPrevious
Doing command Insert Spreads (kNewSpreadCmdBoss) this=0xa52c2bf0 uid[0]=0000 RegularUndo
Doing command (kPrivateInsertSpreadCmdBoss) this=0x7bc14f60 uid[0]=0000 RegularUndo
Doing command (kAddDefaultLayersCmdBoss) this=0x75c0d430 uid[0]=29483 RegularUndo
Doing command (kPrivateNewPageCmdBoss) this=0x7ece65c0 uid[0]=0000 RegularUndo
Doing command (kPrivateInsertPagesInSpreadCmdBoss) this=0x63656f00 uid[0]=0000 RegularUndo
Doing command Apply Master Pages (kApplyMasterSpreadCmdBoss) this=0x75f7b3f0 uid[0]=29498 RegularUndo
Doing command (kPrivateApplyMasterSpreadCmdBoss) this=0x5ff90bb0 uid[0]=29498 RegularUndo
Doing command (kCompoundSequenceCmdBoss) this=0x755b5de0 uid[0]=0000 RegularUndo
Doing command (kSetPageMarginsValidCmdBoss) this=0x7e70bda0 uid[0]=29498 RegularUndo
Doing command (kSetPageColumnsValidCmdBoss) this=0x7e70b840 uid[0]=29498 RegularUndo
Doing command Apply Page Grid Settings (kSetCJKLayoutGridDataCmdBoss) this=0x7527faf0 uid[0]=29498 RegularUndo
Doing command Set Binding Location (kSetBindingLocationCmdBoss) this=0x64ece3d0 uid[0]=29483 RegularUndo
Doing command (kAdjustSpreadTransformCmdBoss) this=0x9c05c390 uid[0]=29483 RegularUndo
Doing command Create Text Frame (kCreateMultiColumnItemCmdBoss) this=0x9b506e60 uid[0]=0000 RegularUndo
Doing command Add New Item (kNewPageItemCmdBoss) this=0x9b56e9f0 uid[0]=0000 RegularUndo
Doing command Apply Object Style (kApplyObjectStyleCmdBoss) this=0x9ba5abb0 uid[0]=29499 RegularUndo
Doing command Modify Frame Options (kAddPageItemAdornmentCmdBoss) this=0x9ba1ca00 uid[0]=29499 RegularUndo
Doing command Modify Frame Options (kAddPageItemAdornmentCmdBoss) this=0x9a92acc0 uid[0]=29499 RegularUndo
Doing command Set Object Export Options (kSetObjectExportOptionsCmdBoss) this=0x7e70bda0 uid[0]=29499 AutoUndoWithPrevious
Doing command Add Path Points (kAddSplinePointsCmdBoss) this=0x9a92acc0 uid[0]=29499 RegularUndo
Doing command Close Path (kClosePathCmdBoss) this=0x9a9db940 uid[0]=29499 RegularUndo
Doing command Set Item Matrix (kSetPMMatrixCmdBoss) this=0xa75ab450 uid[0]=29499 RegularUndo
Doing command Add to hierarchy (kAddToHierarchyCmdBoss) this=0x755b5de0 uid[0]=29499 RegularUndo
Doing command (kSetGraphicFrameDataCmdBoss) this=0x9ba322e0 uid[0]=29499 RegularUndo
Doing command Add New Item (kNewPageItemCmdBoss) this=0x9b56a790 uid[0]=0000 RegularUndo
Doing command Add to hierarchy (kAddToHierarchyCmdBoss) this=0x9b5b37d0 uid[0]=29500 RegularUndo
Doing command Modify Frame Options (kAddPageItemAdornmentCmdBoss) this=0x9b5d61f0 uid[0]=29500 RegularUndo
Doing command Create Text Frame (kNewFrameCmdBoss) this=0x90b87a90 uid[0]=0000 AutoUndoWithPrevious
Doing command Add New Item (kNewPageItemCmdBoss) this=0x9c063480 uid[0]=0000 AutoUndoWithPrevious
Doing command Add to hierarchy (kAddToHierarchyCmdBoss) this=0x9c063200 uid[0]=29501 AutoUndoWithPrevious
Doing command (kAddFrameCmdBoss) this=0x5ff90b90 uid[0]=0000 AutoUndoWithPrevious
Doing command Modify Frame Options (kAddPageItemAdornmentCmdBoss) this=0x7ecedfb0 uid[0]=29501 RegularUndo
Doing command Set Frame Grid Character Count Options (kSetCJKCharCountOptionsCmdBoss) this=0x6363c840 uid[0]=29500 RegularUndo
Doing command Make Adornment Visible (kSetAdornmentVisibilityCmdBoss) this=0x7ecedfb0 uid[0]=29500 RegularUndo
Doing command (kPrivateRecomposeThruFrameCmdBoss) this=0x755b5de0 uid[0]=0000 RegularUndo
Doing command New Text Inset (kNewInsetPageItemCmdBoss) this=0x63657090 uid[0]=29499 AutoUndoWithPrevious
Doing command Add New Item (kNewPageItemCmdBoss) this=0x636ba700 uid[0]=0000 AutoUndoWithPrevious
Doing command Modify Frame Options (kAddPageItemHandleAdornmentCmdBoss) this=0x8c3deeb0 uid[0]=29499 AutoUndoWithPrevious
Doing command Set Item Matrix (kSetPMMatrixCmdBoss) this=0x636ead70 uid[0]=29500 AutoUndoWithPrevious
Doing command (kAdjustSpreadTransformCmdBoss) this=0x636718e0 uid[0]=0000 AutoUndoWithPrevious
Doing command Item XP Changed (kXPItemXPChangedCmdBoss) this=0x9a431a70 uid[0]=29478 AutoUndoWithPrevious
Doing command Item XP Changed (kXPItemXPChangedCmdBoss) this=0x9ba5a160 uid[0]=29499 AutoUndoWithPrevious
Doing command (kFitInViewCmdBoss) this=0x8c21c340 uid[0]=0000 AutoUndoWithPrevious
Doing command (kUpdateDocumentUIStateCmdBoss) this=0x4b455820 uid[0]=0001 AutoUndoWithPrevious
Doing command (kSetFrontDocCmdBoss) this=0x9a42d990 uid[0]=0000 AutoUndoWithPrevious
Doing command (kSetFrontDocCmdBoss) this=0xa526bce0 uid[0]=0000 AutoUndoWithPrevious
Doing command Check export settings (kCheckExportSettingsCmdBoss) this=0x9ba1bbf0 uid[0]=0000 AutoUndoWithPrevious
Doing command (kCheckColorSettingsCmdBoss) this=0x9ba15520 uid[0]=0000 AutoUndoWithPrevious
Doing command (kSetFrontDocCmdBoss) this=0x9a49dc20 uid[0]=0000 AutoUndoWithPrevious
Doing command (kSetFrontDocCmdBoss) this=0x3feb3e00 uid[0]=0000 AutoUndoWithPrevious
Doing command Check export settings (kCheckExportSettingsCmdBoss) this=0x4fe70ab0 uid[0]=0000 AutoUndoWithPrevious
Doing command (kCheckColorSettingsCmdBoss) this=0x7df69940 uid[0]=0000 AutoUndoWithPrevious
Doing command (kSetFrontDocCmdBoss) this=0x75f91690 uid[0]=0000 AutoUndoWithPrevious
Doing command (kSetFrontDocCmdBoss) this=0x3feb4100 uid[0]=0000 AutoUndoWithPrevious
Doing command Check export settings (kCheckExportSettingsCmdBoss) this=0x4b2de830 uid[0]=0000 AutoUndoWithPrevious
Doing command (kCheckColorSettingsCmdBoss) this=0x4b2e6bd0 uid[0]=0000 AutoUndoWithPrevious
Doing command (kSetFrontDocCmdBoss) this=0x636a6770 uid[0]=0000 AutoUndoWithPrevious
Doing command (kSetFrontDocCmdBoss) this=0x3fed6690 uid[0]=0000 AutoUndoWithPrevious
Doing command Check export settings (kCheckExportSettingsCmdBoss) this=0x6376d6b0 uid[0]=0000 AutoUndoWithPrevious
Doing command (kCheckColorSettingsCmdBoss) this=0x8c3fdb00 uid[0]=0000 AutoUndoWithPrevious
Copy link to clipboard
Copied
ok, then it seems kAutoFlowCmdBoss is the correct command.
You need to now check with my point no. 2.
Copy link to clipboard
Copied
Sorry but i have no idea of how to do an observer, do you have advice or some example from which I can take inspiration.
Stefano
Copy link to clipboard
Copied
Would be difficult to explain here.
I will check and investigate and get back to you.
Copy link to clipboard
Copied
Hi @Stefano5C37 ,
I reproduced the problem and InDesign crashed.
1. When doing it manually in InDesign, I didn't find anyway that I can select the frame and autoflow the content. Instead, I always found, we must click on frame outport, placegun gets loaded then perform autoflow.
2. If you can't do thing manually in InDesign then it is most likely you can't do it from code.
3. If I loaded the placegun by clicking on Frame outport and then perform AutoFlow from the code then it worked successfully.
IAutoFlowCmdData->Set(pageUID, kInvalidUID, spreadLayerUIDRef, PMPoint(0,0), kFalse, kTrue).
In conclusion, you can't just autoflow text from the frame until and unless, your placegun is loaded.
Solutions -
1. From your code, detect if frame has overset text. If yes, then load the placegun from the code and execute the AutoFlow command.
OR
2. From the code, detect if frame has overset text. If yes, then create a new text frame and link the frames. Perform this until the last frame don't have overset text.
Copy link to clipboard
Copied
You are right! it was enough to fill the placegun
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Thanks to the patience and help of @Rahul_Rastogi, here's the correct answer.
ErrorCode AutoFlow(UIDRef pageItem, PMPoint attachPoint)
{
ErrorCode result = kFailure;
do{
/// Page
InterfacePtr<IPageList> pageList(DOCUMENT, UseDefaultIID());
if(!pageList)
break;
UID UIDPage = pageList->GetNthPageUID(pageList->GetPageCount()-1);
/// SpreadLayer
InterfacePtr<IHierarchy> hierarchy(pageItem, UseDefaultIID());
if(!hierarchy)
break;
UIDRef UIDRefspreadLayer(DATABASE, hierarchy->GetLayerUID());
/// Fill PlaceGun
if(Utils<Facade::IImportExportFacade>()->LoadPlaceGun(UIDList(pageItem), IPlaceGun::kAddToBack) != kSuccess)
break;
/// Autoflow Command
InterfacePtr<ICommand> autoFlowCmd(CmdUtils::CreateCommand(kAutoFlowCmdBoss));
InterfacePtr<IAutoFlowCmdData> autoFlowCmdData(autoFlowCmd, UseDefaultIID());
autoFlowCmdData->Set(UIDPage, kInvalidUID, UIDRefspreadLayer, attachPoint, kFalse, kTrue);
/// Execute the command
result = CmdUtils::ProcessCommand(autoFlowCmd);
}while(false);
return result;
}
Copy link to clipboard
Copied
Great ! 🙂