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

RE: [Clip] Help creating a NoteTab variable from a text file

Expand Messages
  • John Shotsky
    Yes, that is perfect. Thank you! Regards, John RecipeTools Web Site: http://recipetools.gotdns.com/ From:
    Message 1 of 6 , Oct 1, 2012
      Yes, that is perfect. Thank you!

      Regards,
      John
      RecipeTools Web Site: <http://recipetools.gotdns.com/> http://recipetools.gotdns.com/

      From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Ian NTnerd
      Sent: Sunday, September 30, 2012 18:44
      To: ntb-clips@yahoogroups.com
      Subject: Re: [Clip] Help creating a NoteTab variable from a text file


      John,

      On NTP 6.2 the following works for me.
      ^$StrReplace("^p";"|";"^$GetFileText("c:\path\file.txt")$";Yes;Yes)$

      Is that what you want?

      Ian

      On 1/10/2012 6:12 AM, John Shotsky wrote:
      >
      > I have several text files with lists of items in them. Each item in
      > each list exists on one line, with no blank lines or
      > comment lines included. There may be one or more words.
      > I currently use a loop to process through files looking for these
      > phrases, which works for the most part, although I
      > don't have access to \b to control when a word is part of a larger
      > word that should not be changed.
      >
      > So, I would like to read the text file into a memory variable at the
      > beginning of each run of my library, then just use
      > that variable as needed in various places. I need a vertical bar to
      > replace the CR's between each line. I've played
      > around with this a little, but I seem to be missing some basic thing,
      > like knowing how to do replacements within 'get
      > text' strings.
      >
      > I think it should go something like 'get text' from the file, replace
      > CR with | and store to a variable. I don't want to
      > lose the focus of the currently open file during any part of this process.
      >
      > Here's an example list:
      > This
      > The
      > Then
      > Therefore
      > Thence
      >
      > I want a variable named, perhaps '%T_words%', and it should contain
      > "This|The|Then|Therefore|Thence". In fact, I will
      > place a \b before and after each word, but I'll be able to do that
      > when I see how to replace the CR's.
      >
      > Any ideas?
      > Thanks,
      > John
      >
      > [Non-text portions of this message have been removed]
      >
      >

      [Non-text portions of this message have been removed]



      [Non-text portions of this message have been removed]
    • flo.gehrke
      ... Yes, that works fine for me too. And here is something that possibly could do the full job ;-) With your sample list saved as johnslist.txt, I get to the
      Message 2 of 6 , Oct 1, 2012
        --- In ntb-clips@yahoogroups.com, Ian NTnerd <indiamcq@...> wrote:
        >
        > John,
        >
        > On NTP 6.2 the following works for me.
        > ^$StrReplace("^p";"|";"^$GetFileText("c:\path\file.txt")$";Yes;Yes)$

        Yes, that works fine for me too. And here is something that possibly could do the full job ;-)

        With your sample list saved as johnslist.txt, I get to the desired result with...

        ^!Set %Var%=^$GetFileText(^$GetDocumentPath$johnslist.txt)$
        ^!Set %Var%=^$StrReplace("^P";"|";^%Var%;A)$
        ^!Set %Var%=^$StrReplace("^|(?=\|)|(?<=\|)";"\\b";^%Var%;RA)$
        ^!Set %Var%=^$StrReplace("\|\\b\Z";"";^%Var%;R)$
        ^!Info ^%Var%

        (designed for Ntb 7.0)

        Regards,
        Flo
      • John Shotsky
        Yes, that is even perfecter! :-) Thanks! Regards, John RecipeTools Web Site: http://recipetools.gotdns.com/ From:
        Message 3 of 6 , Oct 1, 2012
          Yes, that is even perfecter! :-)
          Thanks!

          Regards,
          John
          RecipeTools Web Site: <http://recipetools.gotdns.com/> http://recipetools.gotdns.com/

          From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of flo.gehrke
          Sent: Monday, October 01, 2012 03:38
          To: ntb-clips@yahoogroups.com
          Subject: Re: [Clip] Help creating a NoteTab variable from a text file


          --- In ntb-clips@yahoogroups.com <mailto:ntb-clips%40yahoogroups.com> , Ian NTnerd <indiamcq@...> wrote:
          >
          > John,
          >
          > On NTP 6.2 the following works for me.
          > ^$StrReplace("^p";"|";"^$GetFileText("c:\path\file.txt")$";Yes;Yes)$

          Yes, that works fine for me too. And here is something that possibly could do the full job ;-)

          With your sample list saved as johnslist.txt, I get to the desired result with...

          ^!Set %Var%=^$GetFileText(^$GetDocumentPath$johnslist.txt)$
          ^!Set %Var%=^$StrReplace("^P";"|";^%Var%;A)$
          ^!Set %Var%=^$StrReplace("^|(?=\|)|(?<=\|)";"\\b <file:///\\b> ";^%Var%;RA)$
          ^!Set %Var%=^$StrReplace("\|\\b\Z";"";^%Var%;R)$
          ^!Info ^%Var%

          (designed for Ntb 7.0)

          Regards,
          Flo



          [Non-text portions of this message have been removed]
        Your message has been successfully submitted and would be delivered to recipients shortly.