Follow

Scripting for Smart Connection

Comments

7 comments

  • Avatar
    Jens Baumgarten

    I'm actually struggling the the ManagedAdvert structure which should have an assigned pageItem. It appears that this should be pageItems, since it's an array. 

     

    From the doc:

    1.13 ManagedAdvert 1.13.1 Properties Table 1.13.1 ManagedAdvert properties Property Type Access Description entMetaData EntMetaData read Enterprise metadata associated with the advert. pageItem PageItem read Access to the associated InDesign pageitem object. 1

     

    My experience:

            for (var advertIdx=0;advertIdx<doc.managedAdverts.count();advertIdx++) {

                var advert=doc.managedAdverts[advertIdx];

                var name=advert.entMetaData.get("Core_Name");

               var pageItem1=advert.pageItem; // seems to be an array

               var pageItem2=advert.pageItem[0]; // seems to be the item

     

    Could you please double check this? I'm using CC 2014

    Jens

  • Avatar
    Hauke Hell

    Where can I find the scripting documentation for SmartConnection 8?

  • Avatar
    Maarten van Kleinwee

    Hi Hauke,

    The scripting documentation for Smart Connection 8 can be found on our Enterprise 8 documentation page.

    Best regards,

    Maarten van Kleinwee
    Senior Technical Writer, WoodWing Software

  • Avatar
    Hauke Hell

    Hi there,

    the documentation lacks the app.performSimpleRequest() method. Is there any information anywhere else? I wonder if the function is a little too simple to request data from arbitrary web sites.

    Regards
    Hauke

  • Avatar
    Winfried de Vries

    Hi

    you can use app.performSimpleRequest to call an url and pass on some data
    then parse the result:

    rough sample:

    var SERVER = "http://localhost/enterprise";
    var id=42;

    var myurl = SERVER+ '/config/plugins/Claro/savestatus.php?id='+id;
    var myresult=app.performSimpleRequest(myurl);

    // parse the result

  • Avatar
    Hauke Hell

    Hi Winfried,

    we use it in a similar way with our WoodWing servers and that works fine. But now I have a case where I want to request web urls and the content of myresult varies: Mostly it is just the http status (such as "200"), sometimes the whole payload of the web page. That makes it a bit difficult to deal with…

    Regards
    Hauke

  • Avatar
    Winfried de Vries

    Hi Hauke,

    So it's more the parsing/processing of the result that is a challenge?

    I think, as with every good API/connection, you will need to stick to one protocol for the received data.
    We currently mostly use JSON strings as returned data as this is easy to parse with a js.lib

    If you stil need to go to different datasources, then I think you need to buils some 'gateway' webservice.

    from your InDesign javscript you call the gateway, the gateway sends data to the real website,

    the received data can be normalized/formatted in the gateway and then returned to inDesign/javascript

     

    Hope this helps

    Winfried

Please sign in to leave a comment.