Script to modify linking tags

Script to modify linking tags

4
NewbieNewbie
4

    Jul 28, 2016#1

    My file contains multiple display equation tags in the form

    <formula id="dqn1">....</formula> , <formula id="dqn2-6">....</formula>, <formula id="dqn7-8">....</formula>, <formula id="dqn9">....</formula> <formula id="dqn10">....</formula>

    and cross-reference (link) them with

    <xref ref-type="d-formula" rid="dqn1">(1)</xref>, <xref ref-type="d-formula" rid="dqn3">(3)</xref> , <xref ref-type="d-formula" rid="dqn5">(5)</xref> <xref ref-type="d-formula" rid="dqn7">(7)</xref>&#x2013;<xref ref-type="d-formula" rid="dqn8">(8)</xref>

    I would like a script which modifies the above colored tags to

    <xref ref-type="d-formula" rid="dqn2-6">(3)</xref>
    <xref ref-type="d-formula" rid="dqn2-6">(5)</xref>
    <xref ref-type="d-formula" rid="dqn7-8">(7)&#x2013;(8)</xref>

    and keep the other tags intact.

    How could that be done?

    6,603548
    Grand MasterGrand Master
    6,603548

      Jul 29, 2016#2

      What is the rule which defines that

      <xref ref-type="d-formula" rid="dqn3">(3)</xref>

      should be modified to

      <xref ref-type="d-formula" rid="dqn2-6">(3)</xref>

      and

      <xref ref-type="d-formula" rid="dqn5">(5)</xref>

      should be also modified to

      <xref ref-type="d-formula" rid="dqn2-6">(5)</xref>

      That is completely unclear for me.

      An UltraEdit regular expression Replace All can be used for the last two references.

      Find what: ^(rid="dqn^)^([0-9]+^)^(">([0-9]+)^)</xref>&#x2013;<xref ref-type="d-formula" rid="dqn^([0-9]+^)">^(([0-9]+)</xref>^)
      Replace with: ^1^2-^4^3&#x2013;^5

      Same as above with Unix or Perl regular expression engine:

      Find what: (rid="dqn)([0-9]+)(">\([0-9]+\))</xref>&#x2013;<xref ref-type="d-formula" rid="dqn([0-9]+)">(\([0-9]+\)</xref>)
      Replace with: \1\2-\4\3&#x2013;\5
      Best regards from an UC/UE/UES for Windows user from Austria

      4
      NewbieNewbie
      4

        Jul 29, 2016#3

        The rule is: If there are display equation tags in the form "<formula id="dqnDIGIT1-DIGIT2">" and there are individual link ranging from the first (DIGIT) to the last (DIGIT).

        If there are equations in the form say "<formula id="dqn1-4">" and there are links of equations (1), (2), (3) and (4) in the file and they are for some reason in the form

        <xref ref-type="d-formula" rid="dqn1">(1)</xref>, <xref ref-type="d-formula" rid="dqn2">(2)</xref>, <xref ref-type="d-formula" rid="dqn3">(3)</xref> and <xref ref-type="d-formula" rid="dqn4">(4)</xref>

        then each of rid="dqnDIGIT" portions will be changed to rid="dqn1-4" since there is no

        <formula id="dqn1">, <formula id="dqn2">, ... <formula id="dqn4">

        equation tag in the file because they are merged.

        So the script needs to search the file for "<formula id="dqnDIGIT1-DIGIT2">" and if it finds positive results, then it will look for rid="dqnDIGIT1" and add +1 to DIGIT1 and find rid="dqnDIGIT1(+1)" until it reaches DIGIT2 and replace the links.

        I hope I made a little bit clearer :|

        6,603548
        Grand MasterGrand Master
        6,603548

          Jul 29, 2016#4

          Okay, now I have understood the rule for modification of single formula references. But there is one more case which must be taken into account.

          The file contains the formulas:
          • <formula id="dqn1">....</formula>
          • <formula id="dqn2-6">....</formula>
          • <formula id="dqn7-8">....</formula>
          • <formula id="dqn9">....</formula>
          • <formula id="dqn10">....</formula>
          And the file contains also the formula references
          1. <xref ref-type="d-formula" rid="dqn1">(1)</xref>
          2. <xref ref-type="d-formula" rid="dqn3">(3)</xref>
          3. <xref ref-type="d-formula" rid="dqn5">(5)</xref>
          4. <xref ref-type="d-formula" rid="dqn7">(7)</xref>&#x2013;<xref ref-type="d-formula" rid="dqn8">(8)</xref>
          5. <xref ref-type="d-formula" rid="dqn5">(5)</xref>&#x2013;<xref ref-type="d-formula" rid="dqn10">(10)</xref>
          The first single reference is kept unmodified. The value of attribute rid of single references 2 and 3 can be updated. Also the fourth range reference can be updated as described.

          But how to handle the fifth range reference. Should it be modified to

          <xref ref-type="d-formula" rid="dqn2-6">(5)&#x2013;(10)</xref>

          or should it be modified to

          <xref ref-type="d-formula" rid="dqn2-6">(5)</xref>&#x2013;<xref ref-type="d-formula" rid="dqn10">(10)</xref>
          Best regards from an UC/UE/UES for Windows user from Austria

          4
          NewbieNewbie
          4

            Jul 30, 2016#5

            Let's say the file contains the formulas:

            Code: Select all

            <formula id="dqn1">....</formula>
            <formula id="dqn2-6">....</formula>
            <formula id="dqn7-8">....</formula>
            <formula id="dqn9">....</formula>
            <formula id="dqn10">....</formula>
            
            The reference

            Code: Select all

            <xref ref-type="d-formula" rid="dqn2-6">(5)&#x2013;(10)</xref>
            should be modified to

            Code: Select all

            <xref ref-type="d-formula" rid="dqn2-6">(5)</xref><xref ref-type="d-formula" rid="dqn7-8"/><xref ref-type="d-formula" rid="dqn9"/>&#x2013;<xref ref-type="d-formula" rid="dqn10">(10)</xref>
            But those type of links generally do not appear in files. However, the below example does:

            Code: Select all

            <xref ref-type="d-formula" rid="dqn7">(7)</xref>, <xref ref-type="d-formula" rid="dqn8">(8)</xref>, <xref ref-type="d-formula" rid="dqn9">(9)</xref>&#x2013;<xref ref-type="d-formula" rid="dqn10">(10)</xref>
            It should be modified to:

            Code: Select all

            <xref ref-type="d-formula" rid="dqn7-8">(7)&#x2013;(8)</xref>, <xref ref-type="d-formula" rid="dqn9">(9)</xref>&#x2013;<xref ref-type="d-formula" rid="dqn10">(10)</xref>
            The "," and "space" between </xref> and <xref ref-type="d-formula" is also optional.

            6,603548
            Grand MasterGrand Master
            6,603548

              Jul 30, 2016#6

              Wow, the requirements for task became more and more complex. It is really necessary to first define an input text block and a suitable output text block containing all cases which must be taken into account before coding the script can even start.

              The use cases we have already found:
              1. Keep a formula reference as is.
              2. Replace just the identifier of a formula reference.
              3. Put together two or more single formula references separated by commas, whitespaces.
              4. Put together a formula reference range.
              5. Split up a formula reference range to single formula references.
              6. Split up a formula reference range to a combination of 1 or more single formula references and 1 or more formula reference ranges.
              Please provide an input and a suitable example output block which can be used to test the script during development.

              I think, it is best the script first loads in to memory all formula identifiers find in active file into two arrays. The first one is for formulas with an identifier in format dqnX (single formula) and the second array is for formula identifiers in format dqnX-Y (formula ranges). Next the script best expands all existing formula reference ranges to their individual formula references. And then the script can really check on reference versus formula and combine as much as possible to formula reference rages.

              By the way: What to do with a formula reference for which no suitable formula identifier could be found? Should such an invalid reference be marked in any way or reported for example in output window with line number?
              Best regards from an UC/UE/UES for Windows user from Austria

              4
              NewbieNewbie
              4

                Jul 31, 2016#7

                Sample input:

                Code: Select all

                <p>A charge-coupled device <xref ref-type="d-formula" rid="dqn1">(1)</xref> comprising a plurality of rows and columns of capacitively coupled electrodes are provided in which information can be read in by applying signals to certain of the electrodes and storing them in discrete individual elements of the matrix and wherein rapid read-out may be accomplished and wherein the stored charges need not be transferred through a long line or chain of charge-coupled elements. A three-axis embodiment provides for storage elements with three mutually coupled electrodes for receiving inputs and storing information which can be read out as desired.
                <formula id="dqn1">....</formula></p>
                <section id="sec1">
                <ti>DESCRIPTION</ti>
                <p>This is a continuation of applications <xref ref-type="d-formula" rid="dqn3">(3)</xref><xref ref-type="d-formula" rid="dqn4">(4)</xref><xref ref-type="d-formula" rid="dqn5">(5)</xref> Ser. No. 297,338 filed Oct. 13, 1972, now abandoned.</p>
                <section id="sec1a">
                <lbl>1.</lbl>
                <ti>Field of the Invention</ti>
                <p>This invention relates in general to charge-coupled devices <xref ref-type="d-formula" rid="dqn7">(7)</xref>-<xref ref-type="d-formula" rid="dqn8">(8)</xref> and to memories and in particular to a novel charge-coupled memory which has fast read-in and read-out time and which is capable of storing large quantities of information.
                <formula id="dqn2-6">....</formula> where <inline-eq>$M$</inline> is matter density.</p>
                <p>For a simple two-electrode arrangement, depletion zones will be produced directly adjacent to the insulating layer beneath the electrodes. The fixed space charges will be positive if the semiconductor substrate is N-type semiconductor material and will be negative if the substrate is P-type semiconductor material. The space charge zone thus depends on the concentration of doping in the semiconductor and on the magnitude of the applied voltages to the electrodes. Minority charge carriers produced in the semiconductor substrate will have the same sign as the space charge and will collect at the boundary surface beneath the insulating layer. It is possible to shift this movable charge consisting of minority charges from the area below one of the electrodes to under the area below the other electrode, or, vice-versa, by means of varying the potentials which are applied to the two electrodes. Such principle is used to switch charges in the prior art devices.</p>
                <p>It is an object of the present invention <xref ref-type="d-formula" rid="dqn2">(2)</xref> &#x2013; <xref ref-type="d-formula" rid="dqn5">(5)</xref> to provide an improved charge-coupled matrix which eliminates the problems of the prior art.
                <formula id="dqn7-8">....</formula></p>
                <p>Thus a two-dimensional matrix is formed in which binary or other intelligence can be stored and read out at a very rapid rate.</p>
                <p>Minority charge carriers produced in the semiconductor member 1 will have the same charge sign as the spaced charge and will collect at the boundary surface with respect to the insulating layer 3. It is possible to shift this movable charge consisting of minority charges from the area below the electrode 4 into the area below the electrode 5 or vice-versa by controlling the potentials applied to the electrodes 4 and 5.</p>
                <p>In the present invention, pairs of electrodes <xref ref-type="d-formula" rid="dqn9">(9)</xref>, <xref ref-type="d-formula" rid="dqn10">(10)</xref> are mounted on an insulating coating over a semiconductor substrate and corresponding electrodes of each pair are electrically connected together by column leads and corresponding ones of each element are connected together by row leads. Each element of the device includes at least one electrode which is separated from the semiconductor member by the insulating layer and each electrode of each group is connected to at least one other electrode of another group.
                <formula id="dqn9">....</formula>.</p>
                <p>The distance is determined from the equation
                <formula id="dqn10">....</formula>.</p>
                </section>
                </section>
                Desired output:

                Code: Select all

                <p>A charge-coupled device <xref ref-type="d-formula" rid="dqn1">(1)</xref> comprising a plurality of rows and columns of capacitively coupled electrodes are provided in which information can be read in by applying signals to certain of the electrodes and storing them in discrete individual elements of the matrix and wherein rapid read-out may be accomplished and wherein the stored charges need not be transferred through a long line or chain of charge-coupled elements. A three-axis embodiment provides for storage elements with three mutually coupled electrodes for receiving inputs and storing information which can be read out as desired.
                <formula id="dqn1">....</formula></p>
                <section id="sec1">
                <ti>DESCRIPTION</ti>
                <p>This is a continuation of applications <xref ref-type="d-formula" rid="dqn2-6">(3)</xref><xref ref-type="d-formula" rid="dqn2-6">(4)</xref><xref ref-type="d-formula" rid="dqn2-6">(5)</xref> Ser. No. 297,338 filed Oct. 13, 1972, now abandoned.</p>
                <section id="sec1a">
                <lbl>1.</lbl>
                <ti>Field of the Invention</ti>
                <p>This invention relates in general to charge-coupled devices <xref ref-type="d-formula" rid="dqn7-8">(7)&#x2013;(8)</xref> and to memories and in particular to a novel charge-coupled memory which has fast read-in and read-out time and which is capable of storing large quantities of information.
                <formula id="dqn2-6">....</formula> where <inline-eq>$M$</inline> is matter density.</p>
                <p>For a simple two-electrode arrangement, depletion zones will be produced directly adjacent to the insulating layer beneath the electrodes. The fixed space charges will be positive if the semiconductor substrate is N-type semiconductor material and will be negative if the substrate is P-type semiconductor material. The space charge zone thus depends on the concentration of doping in the semiconductor and on the magnitude of the applied voltages to the electrodes. Minority charge carriers produced in the semiconductor substrate will have the same sign as the space charge and will collect at the boundary surface beneath the insulating layer. It is possible to shift this movable charge consisting of minority charges from the area below one of the electrodes to under the area below the other electrode, or, vice-versa, by means of varying the potentials which are applied to the two electrodes. Such principle is used to switch charges in the prior art devices.</p>
                <p>It is an object of the present invention <xref ref-type="d-formula" rid="dqn2-6">(2)&#x2013;(5)</xref> to provide an improved charge-coupled matrix which eliminates the problems of the prior art.
                <formula id="dqn7-8">....</formula></p>
                <p>Thus a two-dimensional matrix is formed in which binary or other intelligence can be stored and read out at a very rapid rate.</p>
                <p>Minority charge carriers produced in the semiconductor member 1 will have the same charge sign as the spaced charge and will collect at the boundary surface with respect to the insulating layer 3. It is possible to shift this movable charge consisting of minority charges from the area below the electrode 4 into the area below the electrode 5 or vice-versa by controlling the potentials applied to the electrodes 4 and 5.</p>
                <p>In the present invention, pairs of electrodes <xref ref-type="d-formula" rid="dqn9">(9)</xref>, <xref ref-type="d-formula" rid="dqn10">(10)</xref> are mounted on an insulating coating over a semiconductor substrate and corresponding electrodes of each pair are electrically connected together by column leads and corresponding ones of each element are connected together by row leads. Each element of the device includes at least one electrode which is separated from the semiconductor member by the insulating layer and each electrode of each group is connected to at least one other electrode of another group.
                <formula id="dqn9">....</formula>.</p>
                <p>The distance is determined from the equation
                <formula id="dqn10">....</formula>.</p>
                </section>
                </section>
                The script has to search only for expression "<formula id="dqnX-Y">....</formula>" and then search every rid="dqnX", rid="dqnX+1" until it reaches rid="dqnY" and replace them.

                And then search for Perl expression "<xref ref-type="d-formula" rid="dqn(\d+)-(\d+)">\((\d+)\)</xref>\s*(&#x2013;|-)\s*<xref ref-type="d-formula" rid="dqn(\d+)-(\d+)">\((\d+)\)</xref>" and replace with "<xref ref-type="d-formula" rid="dqn\1-\2">\(\3\)&#x2013;\(\7\)</xref>".

                All other references like:

                Code: Select all

                <xref ref-type="d-formula" rid="dqn1">(1)</xref>
                <xref ref-type="d-formula" rid="dqn9">(9)</xref>
                <xref ref-type="d-formula" rid="dqn10">(10)</xref>
                should remain the same. I hope this clears all your questions. :)

                81
                Advanced UserAdvanced User
                81

                  Little help required for a reference replace macro

                  Jul 31, 2016#8

                  I have two files say FileA and FileB.

                  FileA contains:

                  Code: Select all

                  rid="deqn1"<disp-formula id="deqn1-2">
                  rid="deqn2"<disp-formula id="deqn1-2">
                  rid="deqn3"<disp-formula id="deqn3-6">
                  rid="deqn6"<disp-formula id="deqn3-6">
                  rid="deqn7"<disp-formula id="deqn7-8">
                  rid="deqn8"<disp-formula id="deqn7-8">
                  rid="deqn9"<disp-formula id="deqn9-10">
                  rid="deqn10"<disp-formula id="deqn9-10">
                  rid="deqn11"<disp-formula id="deqn11-15">
                  rid="deqn15"<disp-formula id="deqn11-15">
                  And FileB (given below) contains some random stuff along will link references of each or some of the equations given in FileA.

                  Code: Select all

                  dsf fds fdfd df <xref ref-type="display-formula" rid="deqn1">(1)</xref> fds dsfds <xref ref-type="display-formula" rid="deqn2">(2)</xref>f dsfds dsf dsfds
                  dsafs ddsf sdfds fds  <xref ref-type="display-formula" rid="deqn17">(17)</xref> sdfds dsfds ds <xref ref-type="display-formula" rid="deqn10">(10)</xref>
                  <xref ref-type="display-formula" rid="deqn15">(15)</xref> sdfd dsf s <xref ref-type="display-formula" rid="deqn17">(17)</xref> dsfdfg 
                  dsfd ds fds sdf <xref ref-type="display-formula" rid="deqn22">(22)</xref> sdfds <xref ref-type="display-formula" rid="deqn9">(9)</xref>
                  <xref ref-type="display-formula" rid="deqn1">(1)</xref>
                  I want to create a macro which first finds rid="deqnX" on FileA then goes to FileA and finds the same thing and if it finds a match, it goes back to FileA copies the correct id which are " id="deqnX-Y"" and replaces all occurrences of the said link and if it doesn't find a match then it searches the next rid="deqnX" from FileA till the end of the file. I have created a macro which needs some modification. Can anyone help?

                  Macro code:

                  Code: Select all

                  InsertMode
                  ColumnModeOff
                  HexOff
                  Loop 99999
                  UltraEditReOn
                  Find RegExp "%rid="deqn[0-9]+""
                  Copy
                  NextWindow
                  UltraEditReOn
                  Find RegExp "^c"
                  IfFound
                  PreviousWindow
                  UltraEditReOn
                  Find RegExp "id="deqn[0-9]+-[0-9]+""
                  Copy
                  NextWindow
                  Key RIGHT ARROW
                  UltraEditReOn
                  Find RegExp Up "rid="deqn[0-9]+""
                  Paste
                  PreviousWindow
                  EndIf
                  IfNotFound
                  PreviousWindow
                  EndIf
                  EndLoop
                  

                  6,603548
                  Grand MasterGrand Master
                  6,603548

                    Aug 08, 2016#9

                    The script for How to find and replace two consecutive link separated by a comma? was not already easy to code. But the script for this task was really a hard challenge. I needed more than 15 hours to code it mainly for thinking on how to handle all those various inputs and possible combinations of cross-references and produce a suitable output.

                    Here is the code of the script:

                    Code: Select all

                    function outputDebugInfo(sDebugInfo)
                    {
                    //   UltraEdit.outputWindow.write(sDebugInfo);
                    }
                    
                    if (UltraEdit.document.length > 0)  // Is any file opened?
                    {
                       // Define environment for this script.
                       UltraEdit.insertMode();
                       UltraEdit.columnModeOff();
                    
                       // Define from which file to read the formula identifiers.
                       var oFormulaDoc = UltraEdit.activeDocument;
                    
                       var nRefIndex;
                       var nFormulaIndex;
                       var anFormulas = new Array();
                    
                       // Select the entire file with the formula identifiers.
                       // There is nothing selected if the file is an empty file.
                       oFormulaDoc.selectAll();
                       if (oFormulaDoc.isSel())
                       {
                          // Get all formula identifiers with a single number and convert each
                          // number from string to integer. The formula identifier numbers are
                          // stored in a two dimensional array. On a single number first and
                          // second number are identical in the two columns in the current row.
                          var asFormulas = oFormulaDoc.selection.match(/<formula id="dqn\d+"/g);
                          if (asFormulas != null)
                          {
                             for (nFormulaIndex = 0; nFormulaIndex < asFormulas.length; nFormulaIndex++)
                             {
                                var nFormula = parseInt(asFormulas[nFormulaIndex].replace(/^.+dqn(\d+).$/,"$1"),10);
                                anFormulas.push([nFormula,nFormula]);
                             }
                          }
                    
                          // Get all formula identifiers with a number range and convert
                          // the two numbers of each number range from string to integer.
                          // The FROM number is stored in first column of formula row and
                          // the TO number is stored in second column.
                          var asFormulas  = oFormulaDoc.selection.match(/<formula id="dqn\d+-\d+"/g);
                          if (asFormulas != null)
                          {
                             for (nFormulaIndex = 0; nFormulaIndex < asFormulas.length; nFormulaIndex++)
                             {
                                var nFrom = parseInt(asFormulas[nFormulaIndex].replace(/^.+dqn(\d+)-.+$/,"$1"),10);
                                var nTo = parseInt(asFormulas[nFormulaIndex].replace(/^.+dqn\d+-(\d+).$/,"$1"),10);
                                anFormulas.push([nFrom,nTo]);
                             }
                          }
                    
                          // Cancel the selection and move caret to top of file.
                          oFormulaDoc.top();
                       }
                    
                       // The formula references can be only checked and updated
                       // if there was before at least 1 formula identifier found.
                       if (anFormulas.length > 0)
                       {
                          // Dumps formular identifiers table to output window.
                          // var_dump(anFormulas);
                    
                          var nRefsFound = 0;     // Counts the number of found formula reference sequences.
                          var nRefsModified = 0;  // Counts the number of modified formula reference sequences.
                    
                          // Define start tag with the attributes and end tag of a formula reference.
                          var sRefStart = '<xref ref-type="d-formula" rid="dqn';
                          var sRefEnd   = '</xref>';
                    
                          // Define some search and replace strings used in the main loop below.
                          var sFindRefs = sRefStart + '[\\d\\-]+">.+?' + sRefEnd + '(?:[\\s,-]*(?:&#x2013;\\s*)?' +
                                          sRefStart + '[\\d\\-]+">.+?' + sRefEnd + ')*';
                          outputDebugInfo("sFindRefs  = " + sFindRefs);
                    
                          var sReplRange = ')' + sRefEnd + '#' + sRefStart + '$1">($1';
                          outputDebugInfo("sReplRange = " + sReplRange);
                    
                          var sRemoveRef = sRefStart + '\\d+">\\((\\d+)\\)' + sRefEnd;
                          outputDebugInfo("sRemoveRef = " + sRemoveRef);
                          var oRemoveRef = new RegExp(sRemoveRef,"g");
                    
                          // A Perl regular expression find is used to find 1 or more formula
                          // references in a loop which are processed and if needed updated. The
                          // formula references are searched and processed always on active file.
                          UltraEdit.perlReOn();
                          UltraEdit.activeDocument.findReplace.mode=0;
                          UltraEdit.activeDocument.findReplace.matchCase=true;
                          UltraEdit.activeDocument.findReplace.matchWord=false;
                          UltraEdit.activeDocument.findReplace.regExp=true;
                          UltraEdit.activeDocument.findReplace.searchDown=true;
                          UltraEdit.activeDocument.findReplace.searchInColumn=false;
                    
                          UltraEdit.activeDocument.top();
                          while (UltraEdit.activeDocument.findReplace.find(sFindRefs))
                          {
                             nRefsFound++;
                             var sReferencesFound = UltraEdit.activeDocument.selection;
                             outputDebugInfo("\nsReferencesFound = " + sReferencesFound);
                    
                             // Replace - and &#x2013; with or without surrounding whitespaces
                             // between > and < (tags) or between ) and ( (reference numbers)
                             // by a hash. Hash character is used as it does not exist anymore
                             // in the reference sequence string after this replace in contrast
                             // to dash character and # is no regular expression character.
                             var sRefModified = sReferencesFound.replace(/([)>])\s*(?:-|&#x2013;)\s*([(<])/g,"$1#$2");
                    
                             // Remove all whitespaces and commas between the tags.
                             sRefModified = sRefModified.replace(/>[\s,]+</g,"><");
                    
                             // Replace already existing rid attribute values with a range
                             // by rid attribute value with a single reference number.
                             sRefModified = sRefModified.replace(/\d+-\d+\">\((\d+)\)/g,'$1">($1)');
                    
                             // Convert a reference number range like (5)#(10) into a complete
                             // reference range like <xref ref-type="d-formula" rid="dqn5">
                             // (5)</xref>#<xref ref-type="d-formula" rid="dqn10">(10)</xref>
                             sRefModified = sRefModified.replace(/\)#\((\d+)/g,sReplRange);
                             outputDebugInfo("sRefModified (1) = " + sRefModified);
                    
                             // Remove the reference start and end tags to get just the reference
                             // single numbers and reference number ranges separated by comma.
                             sRefModified = sRefModified.replace(oRemoveRef,"$1,");
                    
                             // Insert a comma after each hash character used to mark a range.
                             sRefModified = sRefModified.replace(/#/g,"#,");
                    
                             // Remove the comma at end of the string.
                             sRefModified = sRefModified.substr(0,sRefModified.length-1);
                             outputDebugInfo("sRefModified (2) = " + sRefModified);
                    
                             // Split up the reference numbers and reference ranges
                             // for cross-checking them with the formula identifiers.
                             var asReferences = sRefModified.split(",");
                    
                             // Convert the number strings into integer numbers and replace
                             // also the ranges by appropriate sequences of integer numbers.
                             var nRefNumber;
                             var anRefNumbers = new Array();
                             for (nRefIndex = 0; nRefIndex < asReferences.length; nRefIndex++)
                             {
                                if (asReferences[nRefIndex] != '#')
                                {
                                   nRefNumber = parseInt(asReferences[nRefIndex],10);
                                   anRefNumbers.push(nRefNumber);
                                }
                                else
                                {
                                   var nEndNumber = parseInt(asReferences[++nRefIndex],10);
                                   while (nRefNumber < nEndNumber) anRefNumbers.push(++nRefNumber);
                                }
                             }
                             outputDebugInfo("anRefNumbers     = " + anRefNumbers.join(","));
                    
                             // Append to the array the value 0 to end any sequence always
                             // with in the next loop processing the formula references.
                             anRefNumbers.push(0);
                    
                             /* Rebuilt the reference(s) by putting together as much formula
                                references as possible.
                    
                                The base rule for putting a sequence of references together
                                is: The reference numbers are one after the other with each
                                reference number being +1 of previous reference number and
                                no gap between.
                    
                                There are three types of ranges:
                    
                             1. A reference number range within a single reference because the
                                formula identifiers are already put together. E.g. there is
                    
                                   <formula id="dqn2-6">...</formula>
                    
                                and the reference is
                    
                                   <xref ref-type="d-formula" rid="dqn2-6">(3)&#x2013;(5)</xref>
                    
                                It is possible for this type of a range that end number is
                                just start number plus 1, for example
                    
                                <xref ref-type="d-formula" rid="dqn2-6">(5)&#x2013;(6)</xref>
                    
                             2. A formula reference range because the formula identifiers
                                are still separated. For example there are
                    
                                   <formula id="dqn7">...</formula>
                                   <formula id="dqn8">...</formula>
                                   <formula id="dqn9">...</formula>
                    
                                and the matching reference range is
                    
                                   <xref ref-type="d-formula" rid="dqn7">(7)</xref>
                                   <xref ref-type="d-formula" rid="dqn8"/>&#x2013;
                                   <xref ref-type="d-formula" rid="dqn9">(9)</xref>
                    
                             3. The third range type is a combination of first and second like
                    
                                   <xref ref-type="d-formula" rid="dqn2-6">(3)</xref>
                                   <xref ref-type="d-formula" rid="dqn7"/>
                                   <xref ref-type="d-formula" rid="dqn8"/>&#x2013;
                                   <xref ref-type="d-formula" rid="dqn9">(9)</xref>
                    
                                But not put together with a dash is a sequence of exactly
                                2 references with different formula identifiers for first
                                and second reference like
                    
                                   <formula id="dqn7">...</formula>
                                   <formula id="dqn8">...</formula>
                    
                                referenced with
                    
                                   <xref ref-type="d-formula" rid="dqn7">(7)</xref>,
                                   <xref ref-type="d-formula" rid="dqn8">(8)</xref>
                             */
                    
                             var nFormulaStart   = -1;
                             var nFormulaEnd     = -1;
                             var nReferenceStart = -1;
                             var nReferenceEnd   = -1;
                             var nPreviousNumber = -1;
                    
                             nRefIndex = 0;
                             sRefModified = "";
                    
                             while(true)    // This loop is exited when a reference number
                             {              // with the value 0 is loaded from the array.
                                var bFormulaFound = false;
                                nRefNumber = anRefNumbers[nRefIndex];
                    
                                if(nRefNumber > 0)
                                {
                                   // Find the matching formula identifier for this reference.
                                   nFormulaIndex = 0;
                                   do
                                   {
                                      if ((nRefNumber >= anFormulas[nFormulaIndex][0]) &&
                                          (nRefNumber <= anFormulas[nFormulaIndex][1]))
                                      {
                                         bFormulaFound = true;
                                         break;
                                      }
                                   }
                                   while(++nFormulaIndex < anFormulas.length);
                                }
                    
                                // Is there no formula matching the reference number or is the
                                // current reference number not +1 of previous reference number
                                // and the reference is not the first one of a possible range?
                                if((!bFormulaFound || (nRefNumber != (nPreviousNumber+1))) && (nPreviousNumber > 0))
                                {
                                   // Append single or start formula reference.
                                   if (nFormulaStart >= 0)
                                   {
                                      // Append a comma and a space if the rebuilt
                                      // reference string is not empty anymore.
                                      if (sRefModified.length != 0) sRefModified += ", ";
                    
                                      sRefModified += sRefStart + anFormulas[nFormulaStart][0];
                                      if (anFormulas[nFormulaStart][0] != anFormulas[nFormulaStart][1])
                                      {
                                         sRefModified += "-" + anFormulas[nFormulaStart][1];
                                      }
                                      sRefModified += '">(' + nReferenceStart + ')'
                    
                                      // Is there a reference range processing in progress?
                                      if(nFormulaEnd >= 0)
                                      {
                                         // Is this a reference range of first type?
                                         if (nFormulaStart == nFormulaEnd)
                                         {
                                            sRefModified += '&#x2013;(' + nReferenceEnd + ')';
                                         }
                    
                                         // Are there only 2 references and they don't reference the
                                         // same formula identifier, interpret them separated with
                                         // a comma and not as formula reference range with a dash.
                                         else if ((nReferenceStart+1) == nReferenceEnd)
                                         {
                                            sRefModified += sRefEnd + ", " + sRefStart + anFormulas[nFormulaEnd][0];
                                            if (anFormulas[nFormulaEnd][0] != anFormulas[nFormulaEnd][1])
                                            {
                                               sRefModified += "-" + anFormulas[nFormulaEnd][1];
                                            }
                                            sRefModified += '">(' + nReferenceEnd + ')';
                                         }
                    
                                         else  // More than 2 references with different
                                         {     // start and end formula identifiers.
                                            sRefModified += sRefEnd;
                    
                                            // Append the empty formula references between start and
                                            // end reference number depending on existing formulas.
                                            var nSequenceRef = anFormulas[nFormulaStart][1];
                                            while (++nSequenceRef < anFormulas[nFormulaEnd][0])
                                            {
                                               for(var nSequenceIndex = 0; nSequenceIndex < anFormulas.length; nSequenceIndex++)
                                               {
                                                  if ((nSequenceRef >= anFormulas[nSequenceIndex][0]) &&
                                                      (nSequenceRef <= anFormulas[nSequenceIndex][1]))
                                                  {
                                                     sRefModified += sRefStart + anFormulas[nSequenceIndex][0];
                                                     if (anFormulas[nSequenceIndex][0] != anFormulas[nSequenceIndex][1])
                                                     {
                                                        nSequenceRef = anFormulas[nSequenceIndex][1];
                                                        sRefModified += "-" + nSequenceRef;
                                                     }
                                                     sRefModified += '"/>';
                                                     break;
                                                  }
                                               }
                                            }
                    
                                            // Append end formula reference.
                                            sRefModified += '&#x2013;' + sRefStart + anFormulas[nFormulaEnd][0];
                                            if (anFormulas[nFormulaEnd][0] != anFormulas[nFormulaEnd][1])
                                            {
                                               sRefModified += "-" + anFormulas[nFormulaEnd][1];
                                            }
                                            sRefModified += '">(' + nReferenceEnd + ')';
                                         }
                                         nFormulaEnd   = -1;
                                         nReferenceEnd = -1;
                                      }
                                      nFormulaStart   = -1;
                                      nReferenceStart = -1;
                                      sRefModified += sRefEnd;
                                   }
                                }
                    
                                // Are all reference numbers in array processed?
                                if (nRefNumber < 1) break;
                    
                                // Is there no formula for the current formula reference number?
                                if (!bFormulaFound)
                                {
                                   // This case should never occur, but must be nevertheless
                                   // taken into account to avoid corruption of file content.
                    
                                   // Append a comma and a space if the rebuilt
                                   // reference string is not empty anymore.
                                   if (sRefModified.length != 0) sRefModified += ", ";
                    
                                   // Append a formula reference like when the formula would really exist.
                                   sRefModified += sRefStart + nRefNumber + '">(' + nRefNumber + ')' + sRefEnd;
                                   nPreviousNumber = -1;
                    
                                   // Output a warning message to output window and make the output
                                   // window visible if not already visible on running the script.
                                   if (UltraEdit.outputWindow.visible == false)
                                   {
                                      UltraEdit.outputWindow.showWindow(true);
                                   }
                                   UltraEdit.outputWindow.write("WARNING: Found no formula for formula reference " + nRefNumber);
                                }
                                else
                                {
                                   // Is the current reference number +1 of previous number?
                                   if (++nPreviousNumber == nRefNumber)
                                   {
                                      nReferenceEnd = nRefNumber;
                                      nFormulaEnd = nFormulaIndex;
                                   }
                                   else  // First reference of a possible new range.
                                   {
                                      nPreviousNumber = nRefNumber;
                                      nReferenceStart = nRefNumber;
                                      nFormulaStart = nFormulaIndex;
                                   }
                                }
                                nRefIndex++;   // Next reference from array of references.
                             }
                    
                             if (sRefModified != sReferencesFound)
                             {
                                nRefsModified++;
                                // Overwrite the found reference sequence by rebuilt string.
                                UltraEdit.activeDocument.write(sRefModified);
                                outputDebugInfo("sRefModified (3) = " + sRefModified);
                             }
                          }
                    
                          UltraEdit.activeDocument.top();
                          UltraEdit.messageBox("Number of reference sequences found / modified: " + nRefsFound + " / " + nRefsModified);
                       }
                    }
                    
                    Please study the script line by line from top to bottom and ask if something is unclear. I'm quite sure this is the last script I wrote for your company which takes more than 2 hours to code. I suggest that your company hires a programmer for scripting tasks like this one. I'm sure this is a full time job in your company.

                    Line 5 of the output file produced from input file is different than posted above. Instead of creating

                    Code: Select all

                    <xref ref-type="d-formula" rid="dqn2-6">(3)</xref><xref ref-type="d-formula" rid="dqn2-6">(4)</xref><xref ref-type="d-formula" rid="dqn2-6">(5)</xref>
                    the script creates

                    Code: Select all

                    <xref ref-type="d-formula" rid="dqn2-6">(3)&#x2013;(5)</xref>
                    The explanation for this merging behavior can be found in the large block comment in the script which describes the 3 different types of cross-reference ranges handled by the script.

                    Uncomment the line in function outputDebugInfo in third line of the script if you want to see in output window what is going on script execution. You could also uncomment the line var_dump(anFormulas); to see the values of the two dimensional array which holds the identifiers from the formulas/equations as integer numbers.

                    In case of file with the formulas/equations (FileA) is different to the file with the formula references/links (FileB), first modify in the script the line

                    Code: Select all

                    var oFormulaDoc = UltraEdit.activeDocument;
                    to

                    Code: Select all

                    var oFormulaDoc = UltraEdit.document[0];
                    Save the script file, close it and add the script to the Script List.

                    Then open first FileA and second FileB and run the script from the Script List with FileB as active file.
                    Best regards from an UC/UE/UES for Windows user from Austria

                    81
                    Advanced UserAdvanced User
                    81

                      Aug 13, 2017#10

                      The script has a problem that I noticed recently as if there is a link in the format
                      <xref ref-type="display-formula" rid="deqn1">1</xref>
                      or
                      <xref ref-type="display-formula" rid="deqn6">(6v)</xref>
                      it basically converts those links to
                      <xref ref-type="display-formula" rid="deqnNaN">(NaN)</xref>.
                      This should not happen. Parenthesis is not mandatory inside the link tag and neither is the need for the X in rid="deqnX" to be exactly the same as the X in >(X)</xref> or >X</xref>. The file could have a numbered display equation missing, say equation 5, so the id for equation 6 would become deqn5 and so the link would be
                      <xref ref-type="display-formula" rid="deqn5">(6)</xref>
                      or
                      <xref ref-type="display-formula" rid="deqn5">6</xref>.

                      6,603548
                      Grand MasterGrand Master
                      6,603548

                        Aug 13, 2017#11

                        In other words the requirements for the script were incomplete as there are even more variations of data and link format. Well, I don't have to time in the next weeks to think about those new requirements and how to handle those additional variants resulting in Not a Number by parseInt(). Feel free to enhance the script for the new requirements by yourself or wait if somebody else wants to do it for you.
                        Best regards from an UC/UE/UES for Windows user from Austria

                        81
                        Advanced UserAdvanced User
                        81

                          Aug 13, 2017#12

                          Well, the link format is <xref ref-type="display-formula" rid="deqn#">...</xref> and that is the only format applicable in
                          my files and I've modified the script regarding this and seems to work fine, except for cases when there are no parenthesis
                          inside like <xref ref-type="display-formula" rid="deqn5">5</xref> instead of <xref ref-type="display-formula" rid="deqn5">(5)</xref> and I was looking in the script coding where it checks for that but could not find it as I don't have
                          much knowledge in script writing.

                          Anyways, thanks for your reply. I understand you have other things to do too.

                            Aug 26, 2017#13

                            After a lot of trials I've come up with a method to write a script for my task which is quite different from Mofi's method of approach and the code is given below.

                            Code: Select all

                            UltraEdit.activeDocument.selectAll();
                            UltraEdit.activeDocument.copy();
                            var my_File = UltraEdit.clipboardContent;
                            var my_exp = /<disp-formula id="deqn\d+-\d+">/g;
                            var find_exp = my_File.match(my_exp);
                            if (find_exp !== null){
                               UltraEdit.newFile();
                               UltraEdit.activeDocument.setActive();
                               for (var i=0; i<find_exp.length; i++){
                                  UltraEdit.activeDocument.write(find_exp[i]+'\n');
                                  find_exp = my_File.match(my_exp);
                               }
                            }
                            UltraEdit.activeDocument.bottom();
                            UltraEdit.activeDocument.key("BACKSPACE");
                            UltraEdit.activeDocument.unixMacToDos();
                            UltraEdit.activeDocument.trimTrailingSpaces();
                            UltraEdit.activeDocument.selectAll();
                            if (UltraEdit.activeDocument.isSel())
                            {
                               var sLineTerm;
                               if (UltraEdit.activeDocument.lineTerminator <= 0) sLineTerm = "\r\n";
                               else if (UltraEdit.activeDocument.lineTerminator == 1) sLineTerm = "\n";
                               else sLineTerm = "\r";
                               var myString = UltraEdit.activeDocument.selection.split(sLineTerm);
                            }
                            var myRegexp = /([0-9]+)-([0-9]+)/g;
                            my_arr = myRegexp.exec(myString);
                            var idx = 0;
                            while (my_arr !== null) {
                               var a1 = my_arr[0];
                               var xs = a1.split("-");
                               var new1=parseInt(xs[0]);
                               var new2=parseInt(xs[1]);
                               for (var ii=new1; ii<=new2; ii++){
                                  UltraEdit.document[1].write('rid="deqn'+ii+'"/'+myString[idx]+'\n');
                               }
                               idx++;
                               my_arr = myRegexp.exec(myString);
                            }
                            UltraEdit.activeDocument.top();
                            UltraEdit.activeDocument.findReplace.mode=0;
                            UltraEdit.activeDocument.findReplace.matchCase=false;
                            UltraEdit.activeDocument.findReplace.matchWord=false;
                            UltraEdit.activeDocument.findReplace.regExp=false;
                            UltraEdit.activeDocument.findReplace.searchDown=true;
                            UltraEdit.activeDocument.findReplace.searchInColumn=false;
                            UltraEdit.activeDocument.findReplace.preserveCase=false;
                            UltraEdit.activeDocument.findReplace.replaceAll=true;
                            UltraEdit.activeDocument.findReplace.replaceInAllOpen=false;
                            UltraEdit.activeDocument.findReplace.replace('<disp-formula ', 'r');
                            UltraEdit.activeDocument.findReplace.replace('>', '');
                            UltraEdit.activeDocument.bottom();
                            UltraEdit.activeDocument.key("BACKSPACE");
                            UltraEdit.activeDocument.unixMacToDos();
                            UltraEdit.activeDocument.top();
                            UltraEdit.insertMode();
                            UltraEdit.columnModeOff();
                            UltraEdit.document[1].selectAll();
                            if (UltraEdit.document[1].isSel())
                            UltraEdit.activeDocument.trimTrailingSpaces();
                            UltraEdit.activeDocument.selectAll();
                            if (UltraEdit.activeDocument.isSel())
                            {
                               var sLineTerm;
                               if (UltraEdit.activeDocument.lineTerminator <= 0) sLineTerm = "\r\n";
                               else if (UltraEdit.activeDocument.lineTerminator == 1) sLineTerm = "\n";
                               else sLineTerm = "\r";
                               var myFormula = UltraEdit.activeDocument.selection.split(sLineTerm);
                            }
                            
                            var j, ys, new_1, new_2;
                            for (j = 0; j < myFormula.length; j++) {
                               ys = myFormula[j].split("/");
                               new_1 = ys[0];
                               new_2 = ys[1];
                               UltraEdit.document[0].setActive();
                               UltraEdit.activeDocument.top();
                               UltraEdit.activeDocument.findReplace.mode=0;
                               UltraEdit.activeDocument.findReplace.matchCase=false;
                               UltraEdit.activeDocument.findReplace.matchWord=false;
                               UltraEdit.activeDocument.findReplace.regExp=false;
                               UltraEdit.activeDocument.findReplace.searchDown=true;
                               UltraEdit.activeDocument.findReplace.searchInColumn=false;
                               UltraEdit.activeDocument.findReplace.preserveCase=false;
                               UltraEdit.activeDocument.findReplace.replaceAll=true;
                               UltraEdit.activeDocument.findReplace.replaceInAllOpen=false;
                               UltraEdit.activeDocument.findReplace.replace(new_1, new_2);
                            }
                            UltraEdit.perlReOn();
                            UltraEdit.activeDocument.findReplace.mode=0;
                            UltraEdit.activeDocument.findReplace.matchCase=false;
                            UltraEdit.activeDocument.findReplace.matchWord=false;
                            UltraEdit.activeDocument.findReplace.regExp=true;
                            UltraEdit.activeDocument.findReplace.searchDown=true;
                            UltraEdit.activeDocument.findReplace.searchInColumn=false;
                            UltraEdit.activeDocument.findReplace.preserveCase=false;
                            UltraEdit.activeDocument.findReplace.replaceAll=true;
                            UltraEdit.activeDocument.findReplace.replaceInAllOpen=false;
                            UltraEdit.activeDocument.findReplace.replace('rid="deqn(\\w+)-(\\w+)">\\((\\w+)\\)</xref>(\\s+)?(-|&#x2013;)(\\s+)?<xref ref-type="disp-formula" rid="deqn\\1-\\2">', 'rid="deqn\\1-\\2">\\(\\3\\)&#x2013;');
                            The files that I've tested with this script so far seem to work as expected, but the script code is a bit redundant as I'm learning JavaScript. So if anyone can tell which portion of the code can be reduced to be more efficient will be very much appreciated.

                            I added also the command UltraEdit.activeDocument.unixMacToDos(); to my script after seeing it in Mofi's FindStringsToNewFile.js script as this line of code turned out to be very important in my script.

                            What does it actually do and why is it needed when I paste/write into a new document?

                            I know this question might sound a bit stupid but I'm not familiar with the code.

                            Sample text:

                            Code: Select all

                            <p>A charge-coupled device <xref ref-type="disp-formula" rid="deqn1">(1)</xref> comprising a plurality of rows and columns of capacitively coupled electrodes are provided in which information can be read in by applying signals to certain of the electrodes and storing them in discrete individual elements of the matrix and wherein rapid read-out may be accomplished and wherein the stored charges need not be transferred through a long line or chain of charge-coupled elements. A three-axis embodiment provides for storage elements with three mutually coupled electrodes for receiving inputs and storing information which can be read out as desired.
                            <disp-formula id="deqn1">....</formula></p>
                            <section id="sec1">
                            <ti>DESCRIPTION</ti>
                            <p>This is a continuation of applications <xref ref-type="disp-formula" rid="deqn3">(3)</xref><xref ref-type="disp-formula" rid="deqn4">(4)</xref><xref ref-type="disp-formula" rid="deqn5">(5)</xref> Ser. No. 297,338 filed Oct. 13, 1972, now abandoned.</p>
                            <section id="sec1a">
                            <lbl>1.</lbl>
                            <ti>Field of the Invention</ti>
                            <p>This invention relates in general to charge-coupled devices <xref ref-type="disp-formula" rid="deqn7">(7)</xref>-<xref ref-type="disp-formula" rid="deqn8">(8)</xref> and to memories and in particular to a novel charge-coupled memory which has fast read-in and read-out time and which is capable of storing large quantities of information.
                            <disp-formula id="deqn2-6">....</formula> where <inline-eq>$M$</inline> is matter density.</p>
                            <p>For a simple two-electrode arrangement, depletion zones will be produced directly adjacent to the insulating layer beneath the electrodes. The fixed space charges will be positive if the semiconductor substrate is N-type semiconductor material and will be negative if the substrate is P-type semiconductor material. The space charge zone thus depends on the concentration of doping in the semiconductor and on the magnitude of the applied voltages to the electrodes. Minority charge carriers produced in the semiconductor substrate will have the same sign as the space charge and will collect at the boundary surface beneath the insulating layer. It is possible to shift this movable charge consisting of minority charges from the area below one of the electrodes to under the area below the other electrode, or, vice-versa, by means of varying the potentials which are applied to the two electrodes. Such principle is used to switch charges in the prior art devices.</p>
                            <p>It is an object of the present invention <xref ref-type="disp-formula" rid="deqn2">(2)</xref> &#x2013; <xref ref-type="disp-formula" rid="deqn5">(5)</xref> to provide an improved charge-coupled matrix which eliminates the problems of the prior art.
                            <disp-formula id="deqn7-8">....</formula></p>
                            <p>In the present invention, pairs of electrodes <xref ref-type="disp-formula" rid="deqn9">(9)</xref>, <xref ref-type="disp-formula" rid="deqn10">(10)</xref> are mounted on an insulating coating over a semiconductor substrate and corresponding electrodes of each pair are electrically connected together by column leads and corresponding ones of each element are connected together by row leads. Each element of the device includes at least one electrode which is separated from the semiconductor member by the insulating layer and each electrode of each group is connected to at least one other electrode of another group.
                            <disp-formula id="deqn9">....</formula>.</p>
                            <p>The distance is determined from the equation
                            <disp-formula id="deqn10">....</formula>.</p>
                            </section>
                            </section>
                            Expected output:

                            Code: Select all

                            <p>A charge-coupled device <xref ref-type="disp-formula" rid="deqn1">(1)</xref> comprising a plurality of rows and columns of capacitively coupled electrodes are provided in which information can be read in by applying signals to certain of the electrodes and storing them in discrete individual elements of the matrix and wherein rapid read-out may be accomplished and wherein the stored charges need not be transferred through a long line or chain of charge-coupled elements. A three-axis embodiment provides for storage elements with three mutually coupled electrodes for receiving inputs and storing information which can be read out as desired.
                            <disp-formula id="deqn1">....</formula></p>
                            <section id="sec1">
                            <ti>DESCRIPTION</ti>
                            <p>This is a continuation of applications <xref ref-type="disp-formula" rid="deqn2-6">(3)</xref><xref ref-type="disp-formula" rid="deqn2-6">(4)</xref><xref ref-type="disp-formula" rid="deqn2-6">(5)</xref> Ser. No. 297,338 filed Oct. 13, 1972, now abandoned.</p>
                            <section id="sec1a">
                            <lbl>1.</lbl>
                            <ti>Field of the Invention</ti>
                            <p>This invention relates in general to charge-coupled devices <xref ref-type="disp-formula" rid="deqn7-8">(7)</xref>-<xref ref-type="disp-formula" rid="deqn7-8">(8)</xref> and to memories and in particular to a novel charge-coupled memory which has fast read-in and read-out time and which is capable of storing large quantities of information.
                            <disp-formula id="deqn2-6">....</formula> where <inline-eq>$M$</inline> is matter density.</p>
                            <p>For a simple two-electrode arrangement, depletion zones will be produced directly adjacent to the insulating layer beneath the electrodes. The fixed space charges will be positive if the semiconductor substrate is N-type semiconductor material and will be negative if the substrate is P-type semiconductor material. The space charge zone thus depends on the concentration of doping in the semiconductor and on the magnitude of the applied voltages to the electrodes. Minority charge carriers produced in the semiconductor substrate will have the same sign as the space charge and will collect at the boundary surface beneath the insulating layer. It is possible to shift this movable charge consisting of minority charges from the area below one of the electrodes to under the area below the other electrode, or, vice-versa, by means of varying the potentials which are applied to the two electrodes. Such principle is used to switch charges in the prior art devices.</p>
                            <p>It is an object of the present invention <xref ref-type="disp-formula" rid="deqn2-6">(2)</xref> &#x2013; <xref ref-type="disp-formula" rid="deqn2-6">(5)</xref> to provide an improved charge-coupled matrix which eliminates the problems of the prior art.
                            <disp-formula id="deqn7-8">....</formula></p>
                            <p>In the present invention, pairs of electrodes <xref ref-type="disp-formula" rid="deqn9">(9)</xref>, <xref ref-type="disp-formula" rid="deqn10">(10)</xref> are mounted on an insulating coating over a semiconductor substrate and corresponding electrodes of each pair are electrically connected together by column leads and corresponding ones of each element are connected together by row leads. Each element of the device includes at least one electrode which is separated from the semiconductor member by the insulating layer and each electrode of each group is connected to at least one other electrode of another group.
                            <disp-formula id="deqn9">....</formula>.</p>
                            <p>The distance is determined from the equation
                            <disp-formula id="deqn10">....</formula>.</p>
                            </section>
                            </section>
                            The sample text and the expected result had a problem as wrote <formula id="deqnX-Y"> instead of <disp-formula id="deqnX-Y"> ( :( my bad), but now I've edited it, really sorry for that. :oops:

                            6,603548
                            Grand MasterGrand Master
                            6,603548

                              Aug 31, 2017#14

                              The encoding of a new file - ANSI or UTF-8 or UTF-16 (Unicode) - and the line ending/terminator type - DOS/Windows or UNIX or MAC - depend on settings in configuration. A script (or macro) should be written to work independent on those settings for new files. It should create the new file always with the encoding and the line ending type as required for the task which is either fixed or depending on file from which the data is taken.

                              This can be most easily achieved by using after UltraEdit.newFile(); the commands

                              UltraEdit.activeDocument.dosToMac();
                              UltraEdit.activeDocument.unicodeToASCII();


                              Now the new file is always an ASCII/ANSI file with DOS line endings.

                              No more commands are needed if that is the required encoding and line ending type for output file.

                              Otherwise the command UltraEdit.activeDocument.ASCIIToUnicode(); can be used now to change the encoding to UTF-16 or UltraEdit.activeDocument.ASCIIToUTF8(); to change encoding to UTF-8.

                              And the command UltraEdit.activeDocument.dosToUnix(); can be used now to change the line ending type to UNIX or UltraEdit.activeDocument.dosToMac(); to change line ending type to MAC..

                              There are no real data conversions executed by those commands because all those commands are executed on a new file not containing any data. So those commands just change the encoding and line terminator type properties of the new file.

                              After those 2 to 4 commands the encoding and line terminator type for the new file are set as required independent on configuration settings and script can continue writing or pasting data into the new file.
                              Best regards from an UC/UE/UES for Windows user from Austria

                              81
                              Advanced UserAdvanced User
                              81

                                Sep 02, 2017#15

                                Thanks Mofi for the info.
                                BTW, does these commands work on UltraEdit version 14.10? My above posted script does not work in it.
                                I could not find any other reason for it not working. Can you tell what the reason might be?
                                Thanks :)

                                Read more posts (3 remaining)