6 Replies Latest reply on Nov 24, 2011 6:42 AM by RF2009

    [VB JS] Trying to remove characters or pass reference to object to script

    RF2009 Level 1

      Hi all

       

      I'm trying to remove characters using VB scripting (well, actually it's via C# and COM but the problem is the same), and I have found out that the Characters class does not have the Remove() method.

      What I'm trying to do:

       

      JS:
      var tf = indoc.textFrames[0];
      var chars = tf.characters.itemByRange(0,10); //just an example
      chars.remove();     //not available in vb

       

      So, I'm trying to find out how I could do this in VB?

       

      One very simple way is to iterate through the characters and invoke Delete() on them, but that is highly inefficient.

       

      If there is no other way, is there a way to pass a reference/id of an element from C# environment to a javascript? This way I could have the above code in Javascript and just pass a reference to the textframe/object I would like to invoke the script on.

      If I only had the toSource()  method in the vb/COM world I could easily pass the reference, but this is not possible right?

      I would need to be able to find the object also if it's deeply nested inside a table of tables and such, so simply using AllPageItems would not work as far as I recall.

       

      Many thanks in advance
      Ruvan