1 Reply Latest reply on Apr 19, 2012 9:37 PM by michaelmwu

    Using the Fireworks XML RPC API

    michaelmwu

      Hi,

       

      Similar to the discussion here: http://forums.adobe.com/message/3425869#3425869 I am trying to use the XML RPC server in fireworks to export pages of a PNG.

       

      The relevant help url: http://help.adobe.com/en_US/fireworks/cs/extend/WS5b3ccc516d4fbf351e63e3d1183c949219-7ffe. htmlhttp://help.adobe.com/en_US/fireworks/cs/extend/WS5b3ccc516d4fbf351e63e3d1183c949219-7ffe. html

      And the pdf version: http://help.adobe.com/en_US/fireworks/cs/extend/fireworks_cs5_extendin g.pdf (chapter 7)

       

      All I want to do is open a file, call exportPages(), and close it. I would also like to get the names of each page. So far this has been a very painful experience. I have CS5.5 Master Collection on a Windows 7 x64 machine if it matters.

       

      I am able to open the file and call exportPages()

       

      However, I am unable to change the current page in order to get the page names for each page.

       

      I am attempting to carry out this Javascript procedure, which works as a script file with no issues:

       

        var dom = fw.openDocument(file, false, true);

       

        dom.changeCurrentPage(0);

                dom = fw.getDocumentDOM();

       

        for(var p = 0; p < dom.pagesCount; p++){

                          dom.changeCurrentPage(p);

                          dom = fw.getDocumentDOM();

          dom.setPageName(p, dom.pagesCount + "-" + p + "-" + dom.pageName);

        }

       

        if(dom) {

          var dest = dom.filePathForSave;

       

          fw.exportPages(dom,"FWPNG","All",dest);

        }

       

      However, I am unable to call fw.getDocumentDOM()

       

      These are the XML requests and replies:

       

      Request: <func name="openDocument" obj="fw"><string order="0" value="file:///C:/users/mmwu/appdata/local/temp/tmpwhswfa/export.png"></string><bool order="1" value="false"></bool><bool order="2" value="false"></bool></func>

      Return: <return><obj value="4254269" class="DocumentClass"></obj></return>

       

      Request: <get name="pagesCount" obj="4254269"></get>

      Return: <return><int value="3"></int></return>

       

      Request: <func name="changeCurrentPage" obj="4270015"><int order="0" value="0"></int></func>

      Return: <return><null></null></return>

       

      Request: <func name="getDocumentDOM" obj="fw"></func>

      Return: <return error="1"></return>

       

      See error here

       

      Request: <func name="closeDocument" obj="fw"><obj order="0" value="4270015"></obj><bool order="1" value="false"></bool></func>

      Return: <return><null></null></return>

       

      Request: <release obj="4270015"></release>

      Return: <return><void></void></return>

       

      Why can I not call a simple function fw.getDocumentDOM() ?