how can I do a "Find" at the output window

how can I do a "Find" at the output window

4
NewbieNewbie
4

    Jul 17, 2007#1

    Hello,

    When I search in files I want to perform extra Find on the results,
    how can I do that?

    Thanks

    262
    MasterMaster
    262

      Jul 17, 2007#2

      Not sure I understand what you want to do: Do do mean search in a single file Search - Find or search multiple files Search - Find in Files ?

      63
      Advanced UserAdvanced User
      63

        Jul 18, 2007#3

        Hi zevic

        One of my favorite features is to put a check in the box labeled "List Lines Containing String"
        This will bring up a box listing all the places that string is found.

        Now I know that's not exactly what you wanted BUT WAIT THERE'S MORE!
        Click on "Clipboard" button, open a new page and paste.

        Now you can do a search on this page, which is the result of your first search.

        Hope this works for you

        4
        NewbieNewbie
        4

          Jul 18, 2007#4

          Hi jorrasdk and MrBillG,

          when I use find in files I can check "Results to edit window" and this output the results to a new window.
          MrBillG, this is what you meant?

          I see it as inconvenient, because double clicking on a line on new file with the search results wont place me in the file I want like in the output window(I need to open it manualy)

          I just want something like the visual C++ studio of Microsoft, when I search in files, I can perform a find inside the result,s double click on the line I need and and the file is opened.

          6,602548
          Grand MasterGrand Master
          6,602548

            Jul 18, 2007#5

            You cannot run a find within the output window content. Just use Find In Files with a search string which finds exactly what you want then there is no need to run a find in the output window.

            Well, with the script capabilities of UltraEdit v13.10 you could write a script which copies the current output window content to clipboard and next into a string array, open a dialog where you enter the search keyword, search for this keyword in the array and copy the found lines to a new array or reorder the lines in the array, clear output window and write new array or reordered output back to the output window. The script could also directly open the file with the keyword and position the cursor at start of the correct line.
            Best regards from an UC/UE/UES for Windows user from Austria

            262
            MasterMaster
            262

              Jul 18, 2007#6

              Hmm I thought I could offer a kind of a solution if you are a UE 13 user and I'm nearly there, but the last part with positioning at the correct line number is teasing me. But here is what I have got:

              Create this script

              Code: Select all

              UltraEdit.activeDocument.selectLine();
              var selTxt = UltraEdit.activeDocument.selection;
              UltraEdit.activeDocument.key("UP ARROW"); /* unselect */
              
              var path = "";
              var lineno = 0;
              
              /* Regex for fully qualified windows path followed by linenumber */
              var re = /((?:[a-z]:\\)(?:[^\/:*?"<>|\r\n]*\\)?(?:[^\\\/:*?"<>|\r\n]*[.]\w+))[^\d]*(\d+)/im;
              /* Regex for what looks like a filename followed by linenumber */
              var re2 = /([^ \\\/:*?"<>|\r\n]*[.]\w+)[^\d]*(\d+)/im;
              
              var reRes = re.exec(selTxt); /* proces with Regex */
              if (reRes != undefined) { /* fully qualified path found */
              	path = reRes[1];
              	lineno = parseInt(reRes[2]);
              }
              else {
              	var reRes = re2.exec(selTxt); /* proces with Regex */
              	if (reRes != undefined) { /* file found */
              		path = reRes[1];
              		lineno = parseInt(reRes[2]);
              	}
              }
              /* ok a path is found - try and open the file */
              if(path.length>0) {
              	UltraEdit.open(path);
              	UltraEdit.activeDocument.gotoLine(lineno,1);
              }
              Assign the script to a hot key (i.e. Shift+ctrl+O)

              Then suppose you did a Search - Find in Files with the option results to edit window. When the search is done just do subsequent search with normal Search - Find.

              The edit window will contain something like

              Code: Select all

              ----------------------------------------
              Find 'Database' in 'C:\temp\temp.txt':
              C:\temp\temp.txt(682): [[Category:Database]]
              Found 'Database' 1 time(s).
              ----------------------------------------
              Position the cursor in the line with filename and line number and use hot key for the script.

              The file is now opened.

              Alas for some reason it chooses to ignore the gotoLine(lineno,1). I think something is broken. Can anybody confirm gotoLine(lineno,1) not working in this script ?

              6,602548
              Grand MasterGrand Master
              6,602548

                Jul 18, 2007#7

                I think, I have read somewhere in the script posts that after opening of a file, the file does not become automatically the active file for activeDocument. The setActive() command must be used with the correct index number of the now opened document (= last in list of the document array).

                Because in this script the "activeDocument" is only used in the last line maybe following is enough (not tested):

                UltraEdit.document[UltraEdit.document.length-1].gotoLine(lineno,1);
                Best regards from an UC/UE/UES for Windows user from Austria

                262
                MasterMaster
                262

                  Jul 18, 2007#8

                  I tried your suggestion and it didn't work. Tried several variations of setActive.

                  However if I insert a "dummy getString" to pause just before gotoLine:
                  var foo = UltraEdit.getString("foo");
                  the gotoLine works perfectly after returning to the script.

                  Hmm, must see if I can reproduce with a few lines, so IDM support can investigate.

                    Jul 18, 2007#9

                    Ok, now I have something to report to IDM:

                    When this simple script is invoked using hot key the gotoLine doesn't work.

                    Code: Select all

                    UltraEdit.open("C:\\temp\\ASR_CV.txt");
                    UltraEdit.activeDocument.gotoLine(30,1);
                    But if I run it from the script list or the scripting menu option it works like a charm.

                    4
                    NewbieNewbie
                    4

                      Jul 19, 2007#10

                      jorrasd,
                      wow thanks for your effort!, how do I insert a script into UltraEdit?
                      I have UE-32 ver11.b

                      236
                      MasterMaster
                      236

                        Jul 19, 2007#11

                        Scripting is a new feature of V13, sorry...