Skip to main content

Scripting for Smart Connection

Comment

Do you have corrections or additional information about this article? Leave a comment!
Do you have a question about what is described in this article? Please contact Support.


9 comments

  • 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

    0
  • Hauke Hell

    Where can I find the scripting documentation for SmartConnection 8?

    0
  • 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

    0
  • 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

    0
  • Permanently deleted user

    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

    0
  • 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

    0
  • Permanently deleted user

    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

    0
  • Reto Portner

    After an update some InDesign-Scripts don't work anymore. For example the functions "Dossier.items" or "app.queryObjects(criteria)".

    We now have Enterprise Server v10.6.0 Build 267 installed with InDesign CC2019 (14.0.3) and the latest Smart Connection Plug-in 14.1.0 Build 24.

    For example EntMetaData is working. But a dossier including 3 items, the result is an empty string. This script ist working in CC2015 and CC2017, not in CC2019.

    var dossier = app.dossiers.retrieve("245758"); // Dossier ID
    var entMetaData = dossier.entMetaData;
    var name = entMetaData.get("Core_Name");
    alert(name);
    var items = dossier.items;
    alert(items.length);

    Can you check this please?
    Thanks, Reto

    0
  • Permanently deleted user

    Hello Reto,

    In order to check your report, we created a support ticket. We will also include an engineer of your business partner on the support ticket.

    We will answer you via the support ticket.

    0

Please sign in to leave a comment.