2 Replies Latest reply on May 28, 2015 11:53 PM by Wpp Id

    app.doScript(...) timeout?

    Wpp Id

      Hi all,

      I'm struggling with a strange issue. Maybe it's a simple problem, but I can't find a solution.


      I've created a simple function sendEmail(...) that makes an app.doScript(...) call (using Visual Basic Script language).

      In particular I'm using Visual Basic "CDO.Message" Object (see the example below).


      var sendEmail = '';

      sendEmail +='Set emailObj = CreateObject("CDO.Message")\r';

      sendEmail +='...etc...';


      app.doScript(sendEmail, ScriptLanguage.VISUAL_BASIC);


      I call sendEmail(...) function every time a script finishes or every time a script get an error.

      This code works fine, but I'm having some issues when the script execution take a long time.

      It happens that, if the script takes about 2 hours or more time, the email is not sent. It's strange because the script end correctly and doesn't break to this function.


      My last test was that:


      var time = 1000; //1 second

      while(time < 999999999999){


          sendEmail("sleep time: " + (time/60000));  //Print to the email body the sleep time in minutes

          time += 300000; //Add 5 minutes



      My last email received from this test showed:

      sleep time: 150 //2 hours 30 minutes

      And then anything else!!


      Do you have any ideas about that? I'm really confused about that!





        • 1. Re: app.doScript(...) timeout?
          Trevorׅ Adobe Community Professional

          Well that test must of really taken a long time to do!


          It's hard to say without the entire code but it looks like maybe the a limit to how long you can set the sleep for.


          Try either adding a try / catch like this

          try {$.sleep(time)}catch (e) {for (n in e) $.writeln(n + ": " +e[n])}


          Or better still just try in separate 1 line script  (I was very lazy with the enter key :-)

          try {$.writeln(new Date); $.sleep(10000000000000); $.writeln('Slept");}catch (e) {$.writeln(new Date);for (n in e) $.writeln(n + ": " +e[n])}





          • 2. Re: app.doScript(...) timeout?
            Wpp Id Level 1

            Hi Trevor,

            thank you for your reply.

            Yes...this test took about 2/3 days! :-)


            Ok, I will try your suggestions.