XML Convert to CR/LFs - Batch?

XML Convert to CR/LFs - Batch?

2
NewbieNewbie
2

    Sep 29, 2012#1

    Hello there,

    Is there any way for me to convert multiple files from their current format to CR/LFs without having to do it one by one? My output folders have about 140 xml documents in them each time i run the script. I then have to go in and convert to CR/LFs in order to find the field I am looking for. Is there any script or option in Ultraedit that I can run on a folder that would automatically do the XML Convert for me for all the items in the folder I choose, rather then me doing them one at a time? Any help or advice is appreciated. Thanks

    6,675585
    Grand MasterGrand Master
    6,675585

      Sep 29, 2012#2

      If you are using English UltraEdit and have not modified the Find Output Format configuration settings, you can
      • download GetListOfFiles.js,
      • open this UltraEdit script in UltraEdit,
      • replace the last line in this file by

        Code: Select all

        if (GetListOfFiles(nSearchIn,sFolder,sFiles,bSubFolders)) {
           UltraEdit.activeDocument.selectAll();
           var asFileNames = UltraEdit.activeDocument.selection.split("\r\n");
           asFileNames.pop();  // Remove empty string at end of array of file names.
           UltraEdit.closeFile(UltraEdit.activeDocument.path,2);
           UltraEdit.outputWindow.write("\nFound "+asFileNames.length+"file"+((asFileNames.length != 1) ? "s:\n" : ":\n"));
           for (nFile = 0; nFile < asFileNames.length; nFile++) {
              UltraEdit.open(asFileNames[nFile]);
              UltraEdit.activeDocument.xmlConvertToCRLF();
              UltraEdit.closeFile(UltraEdit.activeDocument.path,1);
              UltraEdit.outputWindow.write(asFileNames[nFile]);
           }
        }
      • save the script file,
      • execute it using Scripting - Run Active Script and
      • enter the data for getting the list of XML file names to open, convert, save and close.
      You need to adapt 2 string variables according to comments at top of the script if you are using UltraEdit in a different language or with having Find Summary definition string changed or disabled.

      Note: None of the XML files to convert should be opened already in UltraEdit as this would result in failing of the script.

      2
      NewbieNewbie
      2

        Sep 29, 2012#3

        Worked perfectly. Thanks so much. Wish this was an option in UltraEdit, but this worked perfectly. I mean, wow, amazing, you did it. Thank you!