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

RE: [Clip] Help with variables

Expand Messages
  • John Shotsky
    Yes, that is what I needed. I just didn t understand how to do it. Interesting bit on that last one, that is the one that I just could not figure out. ^!Set
    Message 1 of 12 , Jun 10, 2013
      Yes, that is what I needed. I just didn't understand how to do it. Interesting bit on that last one, that is the one that I just
      could not figure out.
      ^!Set %animal%="cat|rat|dog"
      ^!Set %animals%=^$StrReplace("|";"s?|";"^%animal%";False;False)$s?

      I might even add \b to each item to prevent false captures and not need to write it out explicitly in each clip that uses it. As you
      can see, I am trying to get as much functionality out of variables as I can, so I can cut down on the code I have to write each time
      the variable is used. I have several other such variables that all need the same functionality added.

      Thanks,
      John
      RecipeTools Web Site: http://recipetools.gotdns.com/
      John's Mags Yahoo Group: http://groups.yahoo.com/group/johnsmags/

      -----Original Message-----
      From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Don
      Sent: Monday, June 10, 2013 12:45
      To: ntb-clips@yahoogroups.com
      Subject: Re: [Clip] Help with variables

      Like I said at the outset, I don't get what you want to do exactly and
      it doesn't become clearer to me with repeat of the same.

      I don't think you mean that you want to add s? to the end of each, but
      maybe you do since that is what you said.

      ^!Set %animal%="cat|rat|dog"
      ^!Set %animals%=^$StrReplace("|";"s?|";"^%animal%";False;False)$s?

      Seems to do what you claim you want to do. I am happy to help of
      course, but solving a problem that *I* don't find clearly stated ...
      we'll then I'm guessing at answers.


      On 6/10/2013 2:54 PM, John Shotsky wrote:
      > Thanks for the ideas but…
      >
      > I want to create a variable from another variable that has the same ending on each entity in the new variable. I know how to do it
      > outside the variable, and that's exactly what I don't want to do. I want two variables that I can call upon for whatever need I
      > happen to have. I only want one list of the entities, so I don't have to try to keep two of them in sync. The two variables have
      the
      > same content except that the plural one has s? at the end of each entity inside the variable. I need the code to create the new
      > variable, not a different solution to the problem. In fact, I have been doing it the external way for a long time - but it becomes
      > cumbersome at times, and having a single variable to suit a given purpose works far more efficiently.
      >
      > Regards,
      > John
      > RecipeTools Web Site: <http://recipetools.gotdns.com/> http://recipetools.gotdns.com/
      > John's Mags Yahoo Group: <http://groups.yahoo.com/group/johnsmags/> http://groups.yahoo.com/group/johnsmags/
      >
      > From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Don
      > Sent: Monday, June 10, 2013 11:32
      > To: ntb-clips@yahoogroups.com
      > Subject: Re: [Clip] Help with variables
      >
      >
      > Still not sure I follow ... but okay, just ask for what you want to match:
      > ^!Set %animal%="(cat|rat|dog)"
      > :start_loop
      > ^!Set %singular%=^?{(T=L,H=5) Singular==_Singular Only^=1|Plural
      > Only^=2|Both^=3}
      > ^!If "^%singular%" = "1" single
      > ^!If "^%singular%" = "2" plural
      > ^!If "^%singular%" = "3" both
      > ^!Goto start_loop
      >
      > :single
      > ^!Replace "(^%animal%\b)" >> "*$1*" RWAIS
      > ^!Goto start_loop
      >
      > :plural
      > ^!Replace "(^%animal%s\b)" >> "*$1*" RWAIS
      > ^!Goto start_loop
      >
      > :both
      > ^!Replace "(^%animal%s?\b)" >> "*$1*" RWAIS
      > ^!Goto start_loop
      >
      > On 6/10/2013 12:45 PM, John Shotsky wrote:
      >> I need a way to find ONLY the singular version in one case, and I need to find any version in the other case.
      >>
      >> So, the task is to get the [s?] INTO each element of the second variable itself, not outside it. I realize I can also place
      parens
      >> around the whole thing and treat it as one item, but that gets confusing when you have lots of numbered captures to sort out.
      > Simply
      >> put, I want to use (^%animal%)\b when I'm looking for the singular version, and (^%animals%)\b when I don't care which it is. But
      > I
      >> only want to have to enter all the animal names once, for the singular version of the variable. I just don't know how to do the
      >> replaces inside the variable. That's why I asked.
      >>
      >> Regards,
      >> John
      >> RecipeTools Web Site: <http://recipetools.gotdns.com/> http://recipetools.gotdns.com/
      >> John's Mags Yahoo Group: <http://groups.yahoo.com/group/johnsmags/> http://groups.yahoo.com/group/johnsmags/
      >
      >
      >
      > [Non-text portions of this message have been removed]
      >
      >
      >
      > ------------------------------------
      >
      > Fookes Software: http://www.fookes.com/
      > NoteTab website: http://www.notetab.com/
      > NoteTab Discussion Lists: http://www.notetab.com/groups.php
      >
      > ***
      > Yahoo! Groups Links
      >
      >
      >
      >


      ------------------------------------

      Fookes Software: http://www.fookes.com/
      NoteTab website: http://www.notetab.com/
      NoteTab Discussion Lists: http://www.notetab.com/groups.php

      ***
      Yahoo! Groups Links
    • Eb
      John, If you use a wizard to establish quantity, you could simply set a variable to contain nothing (single), an s (multiple), or s? : ;inside the loop: ^!Set
      Message 2 of 12 , Jun 10, 2013
        John,

        If you use a wizard to establish quantity, you could simply set a variable to contain nothing (single), an s (multiple), or 's?':

        ;inside the loop:
        ^!Set %Q%=^?{Process==singles^=|Multiples^=s|Both^=s?}
        ^!Replace "(^%animal%^%Q%\b)" >> "*$1*" RWAIS

        I don't know if the wizard will handle the '?' properly.

        By the way, "cat|rat|dog" ?! Are you working on recipies for roadkill <grin>?


        Cheers,


        Eb


        --- In ntb-clips@yahoogroups.com, "John Shotsky" <jshotsky@...> wrote:
        >
        > Thanks for the ideas but…
        >
      • John Shotsky
        I can t use a wizard, there are literally hundreds of places these variables are used. All I m trying to do is get the intelligence into the variable, so I
        Message 3 of 12 , Jun 10, 2013
          I can't use a wizard, there are literally hundreds of places these variables are used. All I'm trying to do is get the intelligence
          into the variable, so I don't have to type it into each use. I want to just use the variable, without having to type a bunch of
          qualifiers around them each time they are used. When my tool runs, there are no wizards popping up or other info type dialogs. It
          just runs to completion.

          It's bad enough that I have to go through my whole 1.5M library and replace all my current variable usages with the new variable
          names and without the qualifiers�there are sometimes three variables used in one clip. Originally, I didn't even use variables, and
          had to remember to type in each group using alternation. Then I got half-way smart and switched to variables. Now, I want smart
          variables, again cutting down on typing.

          Here is one current line: Don't worry about what it does, it just shows usage of variables.
          ^!Replace "([\d\.~]+[- ])(^%MetricUnits%) \(?([\d\.~]+[- ])(^%SUnits%)(s)?\b\)?" >> "$3$4$5 ($1$2)" ARSW
          With the new variable usage, it will be:
          ^!Replace "([\d\.~]+[- ])(^%MetricUnits%) \(?([\d\.~]+[- ])(^%Units%)\)?" >> "$3$4 ($1$2)" ARSW
          It might not look like a lot of improvement, but multiply it by hundreds of times, and it becomes more significant. Not having to
          remember the 's' and the '\b' makes it much easier to write and understand, too.

          Road kill�.funny. But I do handle pet food recipes� J

          Regards,
          John
          RecipeTools Web Site: <http://recipetools.gotdns.com/> http://recipetools.gotdns.com/
          John's Mags Yahoo Group: <http://groups.yahoo.com/group/johnsmags/> http://groups.yahoo.com/group/johnsmags/

          From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Eb
          Sent: Monday, June 10, 2013 15:18
          To: ntb-clips@yahoogroups.com
          Subject: Re: [Clip] Help with variables


          John,

          If you use a wizard to establish quantity, you could simply set a variable to contain nothing (single), an s (multiple), or 's?':

          ;inside the loop:
          ^!Set %Q%=^?{Process==singles^=|Multiples^=s|Both^=s?}
          ^!Replace "(^%animal%^%Q%\b)" >> "*$1*" RWAIS

          I don't know if the wizard will handle the '?' properly.

          By the way, "cat|rat|dog" ?! Are you working on recipies for roadkill <grin>?

          Cheers,

          Eb

          --- In ntb-clips@yahoogroups.com <mailto:ntb-clips%40yahoogroups.com> , "John Shotsky" <jshotsky@...> wrote:
          >
          > Thanks for the ideas but�
          >



          [Non-text portions of this message have been removed]
        • Alec Burgess
          John: interesting problem which it looks like Don may have answered (below) .. but ... what do you do about mouse/mice goose/geese etc ... or do they not get
          Message 4 of 12 , Jun 10, 2013
            John: interesting problem which it looks like Don may have answered (below)
            .. but ... what do you do about mouse/mice goose/geese etc ... or do
            they not get involved in your recipe-space.

            if you have rats I'd thing you'd need mice :-)

            Regards ... Alec (buralex@gmail& WinLiveMess - alec.m.burgess@skype)

            On 2013-06-10 15:45, Don wrote:
            > Like I said at the outset, I don't get what you want to do exactly and
            > it doesn't become clearer to me with repeat of the same.
            >
            > I don't think you mean that you want to add s? to the end of each, but
            > maybe you do since that is what you said.
            >
            > ^!Set %animal%="cat|rat|dog"
            > ^!Set %animals%=^$StrReplace("|";"s?|";"^%animal%";False;False)$s?
            >
            > Seems to do what you claim you want to do. I am happy to help of
            > course, but solving a problem that*I* don't find clearly stated ...
            > we'll then I'm guessing at answers.


            [Non-text portions of this message have been removed]
          • John Shotsky
            You ll probably laugh, but I convert them to mouses, gooses, etc until near the end, and then, if it s plural, I substitute the correct term. Foot, feet, loaf,
            Message 5 of 12 , Jun 10, 2013
              You'll probably laugh, but I convert them to mouses, gooses, etc until near the end, and then, if it's plural, I substitute the
              correct term. Foot, feet, loaf, loaves leaf leaves, etc. All become foots, loafs, leafs during the clip run, then at the end I use
              the plural term, if present, to convert to the correct word.

              Regards,
              John
              RecipeTools Web Site: <http://recipetools.gotdns.com/> http://recipetools.gotdns.com/
              John's Mags Yahoo Group: <http://groups.yahoo.com/group/johnsmags/> http://groups.yahoo.com/group/johnsmags/

              From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Alec Burgess
              Sent: Monday, June 10, 2013 16:23
              To: ntb-clips@yahoogroups.com
              Subject: Re: [Clip] Help with variables


              John: interesting problem which it looks like Don may have answered (below)
              .. but ... what do you do about mouse/mice goose/geese etc ... or do
              they not get involved in your recipe-space.

              if you have rats I'd thing you'd need mice :-)

              Regards ... Alec (buralex@gmail& WinLiveMess - alec.m.burgess@skype)

              On 2013-06-10 15:45, Don wrote:
              > Like I said at the outset, I don't get what you want to do exactly and
              > it doesn't become clearer to me with repeat of the same.
              >
              > I don't think you mean that you want to add s? to the end of each, but
              > maybe you do since that is what you said.
              >
              > ^!Set %animal%="cat|rat|dog"
              > ^!Set %animals%=^$StrReplace("|";"s?|";"^%animal%";False;False)$s?
              >
              > Seems to do what you claim you want to do. I am happy to help of
              > course, but solving a problem that*I* don't find clearly stated ...
              > we'll then I'm guessing at answers.

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



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