0 Replies Latest reply on Apr 6, 2014 6:47 AM by salvi_

    Importing and styling multiple xml files

    salvi_ Level 1

      Greetings,

      My goal is to 1) create a menu item - via scriptin- g for the user, in order to select the folder that contains the xml files he wants to import. So far so good, I managed to create that menu item and call the script I wish which is as follows:

      var myDocument = app.documents.add();
      
      var MyFolderWithFiles = Folder.selectDialog ("Choose a folder");
      var myFiles = MyFolderWithFiles.getFiles("*.xml");
      
      for(var i = 0; i < myFiles.length; i++) {
          myDocument.importXML(myFiles[i]);
       }

       

      I want it to create a new document, and insert in that document all the xml files that are in the folder the user selected. The problem is, even though the document is created, nothing else happens, so I can't figure out what the problem is.

       

      And 2) I would like some guidelines as to styling via scripting, cause I couldn't find something useful so far.

       

      Any help will be appreciated.