Loading ...
Sorry, an error occurred while loading the content.
 

[Clip] Re: Search disk clip command

Expand Messages
  • flo.gehrke
    ... Don, I don t think this navigation is that easy in any case. You know the problems we encounter with ^!Keyboard ... In all messages dealing with Search
    Message 1 of 9 , Jul 15, 2012
      --- In ntb-clips@yahoogroups.com, Don <don@...> wrote:
      >
      > Flo, you can easily navigate from there with keyboard commands
      > ... so I think you can use it full power. Yes it would be nice
      > to set the criteria with some commands I suppose, but use a right
      > arrow to go to replace or stay in find and then just fill in the
      > fields and you are off to the races eh?

      Don,

      I don't think this navigation is that easy in any case. You know the problems we encounter with '^!Keyboard'...

      In all messages dealing with 'Search Disk', I can't remember any working solution using '^!Keyboard'. If my memory serves me correctly, we always discussed workarounds only such as using DOS 'findstr' or tools like AgentRansack etc.

      I understand that Dirk just wants to create a list of files containing a defined search string. Example: Find all TXT files in 'E:\NoteTab\Documents\' containing a four-digit-number, and output nothing but a list of matching files without opening those files.

      I played around with that task using '^!Keyboard' but can't get to an elegant and working solution. I would be grateful if you could provide a working '^!Keyboard' clip for that job.

      Regards,
      Flo
    • Don
      How do we test if there are unsaved documents before starting as we get different branches I think if there are unsaved documents.
      Message 2 of 9 , Jul 15, 2012
        How do we test if there are unsaved documents before starting as we get
        different branches I think if there are unsaved documents.

        On 7/15/2012 2:13 PM, flo.gehrke wrote:
        > Don,
        >
        > I don't think this navigation is that easy in any case. You know the problems we encounter with '^!Keyboard'...
        >
        > In all messages dealing with 'Search Disk', I can't remember any working solution using '^!Keyboard'. If my memory serves me correctly, we always discussed workarounds only such as using DOS 'findstr' or tools like AgentRansack etc.
        >
        > I understand that Dirk just wants to create a list of files containing a defined search string. Example: Find all TXT files in 'E:\NoteTab\Documents\' containing a four-digit-number, and output nothing but a list of matching files without opening those files.
        >
        > I played around with that task using '^!Keyboard' but can't get to an elegant and working solution. I would be grateful if you could provide a working '^!Keyboard' clip for that job.
        >
        > Regards,
        > Flo
        >
      • flo.gehrke
        ... Don, I understand that you ve got several open documents -- some have been saved, some are new or changed and have not been saved so far. To find out if
        Message 3 of 9 , Jul 15, 2012
          --- In ntb-clips@yahoogroups.com, Don <don@...> wrote:
          >
          > How do we test if there are unsaved documents before starting
          > as we get different branches I think if there are unsaved
          > documents.

          Don,

          I understand that you've got several open documents -- some have been saved, some are new or changed and have not been saved so far. To find out if any document has not yet been saved you could execute...


          ^!Document First

          :Loop
          ^!IfTrue ^$IsModified$ Message
          ^!If ^$GetDocIndex$ = ^$GetDocCount$ Out
          ^!Document Next
          ^!Goto Loop

          :Out
          ^!Info No unsaved documents
          ^!Goto End

          :Message
          ^!Continue Unsaved Document!^%NL%Save it with OK or cancel clip^%NL%and close it without saving.^%NL%Then start clip anew if^%NL%there are documents left.
          ^!Save


          Regards,
          Flo
        • vanwasdi
          Thanks all for your comments. I am thinking of starting a second instance of Notetab with a clip that minimizes it and readonlyopens the files of a directory
          Message 4 of 9 , Jul 17, 2012
            Thanks all for your comments.

            I am thinking of starting a second instance of Notetab with a clip that minimizes it and readonlyopens the files of a directory (or a certain number of files). Then I can let the clip do the searching on the open docs, place the filenames with the searched word in a variable and (after doing all the files) make one html-file from all the found files with the found words highlighted. I then can open the html in a browser and see the results. After that Notetab closes.
            All the preceding is done by the second instance of Notetab. Meanwhile I can keep working in the first.
            I do not have much time for the moment, but I will post the clip when it is finished, or ... call for your help when I get stuck :)

            Greetings,
            Dirk


            --- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
            >
            > vanwasdi wrote:
            > > Apparently there is no clip command to search disk
            >
            > Not as such, but you can easily invoke a menu command from clips and for
            > cases where find and replace in files won't suffice anyway, because you
            > need to make more than one simple change, all the parts needed are
            > there. I have a clip template for just this kind of thing:
            >
            > ---------------------------------------------------------------
            > ; Adapt this part to the task in hand
            > ^!Set %varFIL%="F:\Webspace\index.php"
            > ^!Set %varPAT%="*.htm;*.php"
            > ; End of individual adaptation
            >
            > ^!SetWizardLabel "Please define the files to be converted"
            > ;^!SetDebug On
            > ; very long line begins
            > ^!Set %varFIL%=^?{(T=O;F="Source
            > Files|*.html;*.htm;*.?html;*.xml;*asp;*.css;*.php;*.php3;*.php4")Sample
            > file=^%varFIL%}; %varSDR%=^?{(T=L)Include Subdirectories?==_Yes|No};
            > %varPAT%=^?{Search Pattern=^%varPAT%}
            > ; long line ended
            > ^!Set %varPTH%=^$GetPath(^%varFIL%)$
            > ^!If "^%varSDR%"="Yes" yessub ELSE nosub
            > :yessub
            > ^!Set %varFIL%=^$GetFileFirst("+^%varPTH%";"^%varPAT%")$
            > ^!Goto loop
            > :nosub
            > ^!Set %varFIL%=^$GetFileFirst("^%varPTH%";"^%varPAT%")$
            > :loop
            > ^!IfTrue ^$IsEmpty(^%varFIL%)$ finished
            > ;^!Continue ^%varFIL%
            > ^!Open "^%varFIL%"
            >
            > ; Adapt this part to the task in hand
            >
            >
            >
            >
            > ; End of individual adaptation
            >
            > :done
            > ^!Close ALL,SAVE
            > ^!Set %varFIL%=^$GetFileNext$
            > ^!Goto loop
            > :finished
            > ^!CloseFileFind
            > ---------------------------------------------------------------
            >
            > Axel
            >
          • Axel Berger
            ... Yes, that s certainly passible. Possibly it is being an old-timer from the the time when RAM was at a premium, but those huge variables or arrays never
            Message 5 of 9 , Jul 17, 2012
              vanwasdi wrote:
              > Then I can let the clip do the searching on the open docs, place
              > the filenames with the searched word in a variable and (after doing
              > all the files) make one html-file from all the found files with
              > the found words highlighted.

              Yes, that's certainly passible. Possibly it is being an old-timer from
              the the time when RAM was at a premium, but those huge variables or
              arrays never feel right to me. I prefer writing auxiliary files. Here's
              how I've done a similar job:

              ---------------------------------------------------------------
              ; long line begins
              ^!Set %tmpf%="^$ExpandEnv("%temp%")$\00A.CSV"; %sstr%=^?{Search string:}
              ; long line ends
              ^!DeleteFile ^%tmpf%
              ^!Jump TEXT_START
              :loop
              ^!Find "^%sstr%" STI
              ^!IfError finis
              ^!Select LINE
              ^!AppendToFile "^%tmpf%" ^$GetSelection$
              ^!Goto loop
              :finis
              ^!Open "^%tmpf%"
              ---------------------------------------------------------------

              Axel
            Your message has been successfully submitted and would be delivered to recipients shortly.