Skip navigation
Currently Being Moderated

CSXSInterface.instance.evalScript("alert('x', 'y', false)") Crashes IND When Debugging

Apr 10, 2012 1:22 AM

IND 5.0, Actionscript

 

Hi All,

 

I have found that the command CSXSInterface.instance.evalScript("alert('x', 'y', false)") works fine in a normal run (i.e., displays the Alert dialog in InDesign), but causes InDesign to crash and close if the same code is run in the debugger.

 

Any ideas?

 

TYIA,

mlavie

 
Replies
  • Currently Being Moderated
    Apr 15, 2012 2:59 PM   in reply to mlavie

    Do you get the crash with HostObject?

     

    Do you have a modal dialog open?

     

    Harbs

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 16, 2012 12:44 AM   in reply to mlavie

    There's no reason to be using evalScript in InDesign.

     

    Try this method:

    http://cookbooks.adobe.com/post_Communicating_between_JavaScript_and_t he_Creative-17383.html

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 18, 2012 1:23 PM   in reply to Harbs.

    Harbs, thank you very very very much for the link. It's very nice technique.

     

    But I have one question to you. Can I pass Array from jsx to sdk? I mean the real array, not a xml of string or anything?

     

     

    On the very bottom of the post in the link you provided, theres an example:

     

      var d:Document = new Document();  
     
    d.hostObjectDelegate = jsxInterface.getDocumentFromJSX();

     

    And it works great, but only for SDK-specific classes, because they have a 'hostObjectDelegate" property/function.

     

    Array doesn't have one, so how can i get an array from JSX?

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 18, 2012 1:22 AM   in reply to czlowiekuman

    Yes. You can pass an array, but it will not be an ActionScript Array type.

     

    Type it as an Object (which is basically all a javascript Array really is), and it'll work as expected.

     

    Something like this:

     

    Javascript:

     

    function getArray(){

        return [1,2,3,4];

    }

     

    ActionScript:

     

    var jsArray:Object = jsxInterface.getArray();

    trace(jsArray[1]); // returns "2".

     

    Harbs

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 18, 2012 1:13 PM   in reply to Harbs.

    I've seen several references to the jsxInterface, but my compiler can't seem to find it.  I'm using CS Extension Builder 4.6.  What library/imports do I need to get access to this object??

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 18, 2012 1:21 PM   in reply to Meate

    Its shorthand for referencing HostObject.

     

    Read the cookbook post. It's all explained there.

     

    Harbs

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 18, 2012 1:35 PM   in reply to Harbs.

    I'm an idiot.  Let's just leave it at that

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 18, 2012 2:45 PM   in reply to Harbs.

    Thank you very much Hrabs. With this 2 short post you helped me more, than anything and anybody since my start with creative SDK (like 2 months now)

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 22, 2013 1:38 AM   in reply to czlowiekuman

    Hello Harbs,

     

    This has been a very helpful post, thank you!

     

    The link to the cook book is broken, do you have a new one?

     

    Thank you.

     

    P.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 24, 2013 4:48 AM   in reply to Pickory

    Cookbooks are no longer available:

    http://forums.adobe.com/message/5724928

     

     

    Harbs

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 17, 2014 8:16 AM   in reply to Harbs.

    since the Cookbooks are no longer available, can you please write here what is the methode to be used instead of 'evalscript' ?


     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points