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

Re: [Clip] How to capture length of several selections and copy length to variable.

Expand Messages
  • Don - HtmlFixIt.com
    ... This seems to work: ^!Info [C]Copy Characters Before Name and Hit Control C ^!SetClipboard ... ^!Delay 5 ^!If ^$GetClipboardSize$ = 0 Loop1 ^!Set
    Message 1 of 4 , Oct 12 10:12 PM
      > I want to be able to capture the length of each "field" by highlighting it.
      >
      > I use this regex:
      > "^.{^%a%}(.{^%name%})(.{^%school%}).{^%b%}(.{^%c%}).*"
      >
      > So I need to set a, name, school, b and c.
      >
      > Currently I use a wizard and first have to count the number of
      > characters in each field (I highlight them and write down the selection
      > length).

      This seems to work:

      ^!Info [C]Copy Characters Before Name and Hit Control C
      ^!SetClipboard

      :Loop1
      ^!Delay 5
      ^!If "^$GetClipboardSize$" = "0" Loop1
      ^!Set %a%=^$GetClipboardSize$

      ^!Info [C]Copy Name Field and Hit Control C
      ^!SetClipboard
      :Loop2
      ^!Delay 5
      ^!If "^$GetClipboardSize$" = "0" Loop2
      ^!Set %name%=^$GetClipboardSize$

      ^!Info [C]Copy School Field and Hit Control C
      ^!SetClipboard
      :Loop3
      ^!Delay 5
      ^!If "^$GetClipboardSize$" = "0" Loop3
      ^!Set %school%=^$GetClipboardSize$

      ^!Info [C]Copy Extra Characters After School and Hit Control C
      ^!SetClipboard
      :Loop4
      ^!Delay 5
      ^!If "^$GetClipboardSize$" = "0" Loop4
      ^!Set %b%=^$GetClipboardSize$

      ^!Info [C]Copy Time Field and Hit Control C
      ^!SetClipboard
      :Loop5
      ^!Delay 5
      ^!If "^$GetClipboardSize$" = "0" Loop5
      ^!Set %c%=^$GetClipboardSize$

      ^!Jump Line_Start
      ^!InsertText *^%a%*^%name%*^%school%*^%b%*^%c%


      ODD BEHAVIOR?
      If you use this:
      ^!SetClipboard ""
      I would expect a blank clipboard ... but instead it has a length of two
      and a value of "".

      Any other time you quote nothing in notetab clips, such as in an if
      statement, it means nil. So I simply had to use
      ^!SetClipboard^P where control p is a return. That sets the clipboard
      to nothing.
    • Flo
      ... Don, Wouldn t it be easier to first separate those five fields with a delimiter like this: 1 315 |First Last |Team 11 |15:38.1| 4:55 Now, if
      Message 2 of 4 , Oct 13 5:18 AM
        --- In ntb-clips@yahoogroups.com, "Don - HtmlFixIt.com" <don@...>
        wrote:

        > This seems to work:
        > ^!Info [C]Copy Characters Before Name and Hit Control C

        Don,

        Wouldn't it be easier to first separate those five fields with a
        delimiter like this:

        1 315 |First Last |Team 11 |15:38.1| 4:55

        Now, if this string is stored in line #1 of your document you could
        run...

        ^!ClearVariables
        ^!SetDelimiter "|"
        ^!Set %Output%=a:^$StrSize(^$GetField(1;1)$)$ name:^$StrSize
        (^$GetField(1;2)$)$ school:^$StrSize(^$GetField(1;3)$)$ b:^$StrSize
        (^$GetField(1;4)$)$ c:^$StrSize(^$GetField(1;5)$)$
        ^!Jump Doc_End
        ^!InsertText ^P^%Output%

        The output would be...

        a:12 name:21 school:8 b:7 c:7

        Regards,
        Flo
         
      • Sheri
        I believe what you re looking for is: ^!Info ^$GetSelSize$ Regards, Sheri
        Message 3 of 4 , Oct 13 6:15 AM
          I believe what you're looking for is:

          ^!Info ^$GetSelSize$

          Regards,
          Sheri
        Your message has been successfully submitted and would be delivered to recipients shortly.