2 Replies Latest reply on Oct 25, 2011 12:35 PM by Loic.Aigon

    Error while moving xmlElements

    Loic.Aigon Adobe Community Professional

      Hi,

       

      I am a bit lost. I have a process like this

       

       

      var masterItem = mySourceXMLElement;
      var copy = masterItem.duplicate();
      var targetItem = myTargetXMLElement;
      copy = copy.move(LocationOptions.AFTER, targetItem);
      

       

      It works perfect except, of course, at the customer's office. It throws an error I am trying to translate in plain english by "You cannot do that operation with selected element".

      For the info, I downgrade scriptversion from 7.5 to 6 as the script is for CS4. I also take care to unlock any objects and display any layer. So I can't imagine locking is the key.

       

      Fact is the same file is treated like a charm here but not on customer machine. I can't explain myself what is wrong. And as a summum I even get a quantum effect where the result is both true and false.

      I am logging the part where the user has issues and :

       

      try{
           xmlElements.move()
           $.writeln("success");
      }
      catch(e){
           $.writeln("error");
      }
      outputs "success" and "error"
      

       

      I new fresh points of views

       

      Thanks in advnce,

       

      Loic

        • 1. Re: Error while moving xmlElements
          John Hawkinson Level 5

          Are you trying to move a single XMLElement (copy) or multiple (xmlElements)?

          Anyhow, your try/catch is interesting. The implication, to me, is that the $.writeln() is failing, after it outputs the text. This might not be what's going on, but. I would try:

           

          var weird = "";
          try {
            xmlElements.move(); // don't forget semicolon?
            weird+="S";
            $.writlen("success");
          } catch (e) {
             weird += "E";
             $.writeln("error "+e);
          } finally {
            $.writeln("log: "+weird);
          }
          

          That is: 1) See if 'weird' gets appended to in both places 2) print out the value of the error message. You could also print e.source to get the exact line if that helped. 3) print out the results of 'weird' in the finally clause (of try/catch/finally).

           

          I agree, this is definitely puzzling! Are you using the same XML document as your customer?

          • 2. Re: Error while moving xmlElements
            Loic.Aigon Adobe Community Professional

            Hi john,

             

            Thanks a lot for your concern

             

            I am trying t o move a xmlElement which hosts a table. I will try your proposal on site

            I let you know then

             

            Thx again