Skip to main content
Participant
January 10, 2008
Question

help me !!!!!!!!!!!!! how to use IAutoFlowCmdData?

  • January 10, 2008
  • 3 replies
  • 1677 views
I Want to auto flow xml file into indesign,
I find IAutoFlowCmdData,
but how can i use it????

help me, please!

thank u.
This topic has been closed for replies.

3 replies

Inspiring
July 31, 2023

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;
}

 

Inspiring
July 31, 2023

Great ! 🙂

 

Inspiring
July 21, 2023

I've got the same problem of @_m_momchilov_ .

Someone know how to resolve?

Stefano

Participant
June 12, 2008
I use the following code: <br /><br /> InterfacePtr<ICommand> autoFlowCmd(CmdUtils::CreateCommand(kAutoFlowCmdBoss)); <br /> if (!autoFlowCmd)<br /> {<br /> break;<br /> }<br /> InterfacePtr<IAutoFlowCmdData> iAutoFlowCmdData(autoFlowCmd, UseDefaultIID());<br /> ASSERT(iAutoFlowCmdData);<br /> if(!iAutoFlowCmdData)<br /> {<br /> break;<br /> }<br />InterfacePtr<IHierarchy> iHierarchy(pDB , boxUID , UseDefaultIID());<br /> if(!iHierarchy)<br /> {<br /> break;<br /> }<br />iAutoFlowCmdData->Set(pageUID , boxUID , UIDRef(pDB , iHierarchy->GetLayerUID()) , PMPoint(0,0));<br /><br /> if(CmdUtils::ProcessCommand(autoFlowCmd) != kSuccess)<br /> {<br /> ErrorUtils::PMSetGlobalErrorCode(kSuccess, kFalse);<br /> break;<br /> }<br /><br />But i get crash when execute the command.<br />I can't find any samples into the internet and the into adobe helps!?<br />Can someone help with advice?
Inspiring
July 21, 2023

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

Inspiring
July 24, 2023

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);
}