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

Re: Clip or Script to strip headings from a file

Expand Messages
  • essinger2001
    Hi Sheri, Thanks for the sample code. It works great - I have adapted it to change all spaces to a single space, Strip the ending blanks, and replace
    Message 1 of 7 , Apr 30 11:57 PM
    • 0 Attachment
      Hi Sheri,

      Thanks for the sample code. It works great - I have adapted it to
      change all spaces to a single space, Strip the ending blanks, and
      replace remaining spaces with commas. What I get is a report that
      should be spreadsheet (can't get them to send in the needed format,
      just the report), and I am getting it to a CSV file to import it to a
      spreadsheet. I would like to prompt for the replacement value as the
      form of the date is mm/dd/yy, and changes with each sending of the
      report. I am not understanding the prompting for variables at run
      time. Any help?

      Thanks again!

      Jim

      --- In ntb-clips@yahoogroups.com, "Sheri" <silvermoonwoman@...> wrote:
      >
      >
      > Hi Jim,
      >
      > Here's something to help get you started. The !Setdebug helps you see
      > what your clip is doing (until it does what you need). As is, this clip
      > will find "2006", select 7 lines including the one the 2006 is on, and
      > delete those lines. You can copy the following lines to the clipboard,
      > and then add them as a new clip to your clip library by right clicking
      > in your clip panel and selecting "Add from Clipboard."
      >
      > Another possible approach would be to do the task using a regular
      > expression to replace matching lines (with empty text) either using the
      > Search and Replace dialog or a clip with a single ^!Replace command.
      >
      > Aside from the ^!Setdebug command, it is useful to know that comments
      > start with a semicolon, and to stop a runaway clip you press Ctrl+Alt.
      >
      > Have fun,
      > Sheri
      >
      > H="userdelheads"
      > ^!Setdebug on
      > :LoopStart
      > ^!Find "2006" TS
      > ^!Iferror End
      > ^!Jump Select_Start
      > ^!Select 7
      > ;Next command picks up carriage return/line feed on the last line
      > ^!Select +2
      > ^!Menu Edit/Cut
      > ^!Goto LoopStart
      > :EndLoop
      > ;end of clip
      >
      > [Non-text portions of this message have been removed]
      >
    • Sheri
      Hi Jim, Working with variables, your variable names will be surrounded with percent signs. To get the value stored by a variable, prefix the variable name with
      Message 2 of 7 , May 1, 2006
      • 0 Attachment
        Hi Jim,

        Working with variables, your variable names will be surrounded with
        percent signs. To get the value stored by a variable, prefix the
        variable name with a caret.

        Prompting in clips is done with clip wizards. They follow a set format
        (need to refer to the help file for clips).

        Hopefully the following example shows some basics you can use. You could
        put in more edits on the date values, but I shouldn't think you would
        need them assuming you'll be using the clip yourself.

        Let me know if you have any questions, there are a few comments in the
        clip.

        Regards,
        Sheri

        H="DateWiz"
        ^!Set %repdate%="^$GetDate(mm/dd/yyyy)$"
        :StartWiz
        ^!Set %repdate%="^?{(M="00/00/0000";x;0) Please enter date in mm/dd/yyyy
        format=^%repdate%}"
        ^!Set %mo%="^$StrCopyLeft("^%repdate%";2)$"
        ^!Set %day%=^$StrCopy("^%repdate%";4;2)$
        ^!Set %year%=^$StrCopyRight("^%repdate%";4)$
        ^!Set %yr%=^$StrCopyRight("^%repdate%";2)$
        ;Following variable if you need to use a 2-digit year
        ^!Set %usedt%="^%mo%/^%day%/^%yr%"
        ^!IfInRange ^%mo% 1..12 Next ELSE BadDate
        ^!IfInRange ^%day% 1..31 Next ELSE BadDate
        ;the following commands are available but IfInDateRange
        ;gives a syntax error if testdt has bad combo of month and day
        ;^!Set %testdt%="^%year%/^%mo%/^%day%"
        ;^!IfInDateRange ^%testdt% 1999/01/01..2006/12/31 Next ELSE BadRange
        ^!Info Acceptable Date ^%repdate%
        ^!Goto KillVars
        :BadDate
        ^!Info Bad Month: "^%mo%" or Bad Day: "^%day%"
        ^!Goto StartWiz
        :BadRange
        ^!Info Not in Range 01/01/1999..12/31/2006: ^%repdate%
        ^!Goto StartWiz
        :KillVars
        ;not required but unless cleared variable sometimes cause
        ;unexpected results and take up memory
        ^!ClearVariable %repdate%
        ^!ClearVariable %mo%
        ^!ClearVariable %day%
        ^!ClearVariable %year%
        ^!ClearVariable %yr%
        ^!ClearVariable %usedt%
        ;end of clip


        --- In ntb-clips@yahoogroups.com, "essinger2001" <Dilbernator@...>
        wrote:
        >
        > Hi Sheri,
        >
        > Thanks for the sample code. It works great - I have adapted it to
        > change all spaces to a single space, Strip the ending blanks, and
        > replace remaining spaces with commas. What I get is a report that
        > should be spreadsheet (can't get them to send in the needed format,
        > just the report), and I am getting it to a CSV file to import it to a
        > spreadsheet. I would like to prompt for the replacement value as the
        > form of the date is mm/dd/yy, and changes with each sending of the
        > report. I am not understanding the prompting for variables at run
        > time. Any help?
        >
        > Thanks again!
        >
        > Jim
        >
        > --- In ntb-clips@yahoogroups.com, "Sheri" silvermoonwoman@ wrote:
        > >
        > >
        > > Hi Jim,
        > >
        > > Here's something to help get you started. The !Setdebug helps you
        see
        > > what your clip is doing (until it does what you need). As is, this
        clip
        > > will find "2006", select 7 lines including the one the 2006 is on,
        and
        > > delete those lines. You can copy the following lines to the
        clipboard,
        > > and then add them as a new clip to your clip library by right
        clicking
        > > in your clip panel and selecting "Add from Clipboard."
        > >
        > > Another possible approach would be to do the task using a regular
        > > expression to replace matching lines (with empty text) either using
        the
        > > Search and Replace dialog or a clip with a single ^!Replace command.
        > >
        > > Aside from the ^!Setdebug command, it is useful to know that
        comments
        > > start with a semicolon, and to stop a runaway clip you press
        Ctrl+Alt.
        > >
        > > Have fun,
        > > Sheri
        > >
        > > H="userdelheads"
        > > ^!Setdebug on
        > > :LoopStart
        > > ^!Find "2006" TS
        > > ^!Iferror End
        > > ^!Jump Select_Start
        > > ^!Select 7
        > > ;Next command picks up carriage return/line feed on the last line
        > > ^!Select +2
        > > ^!Menu Edit/Cut
        > > ^!Goto LoopStart
        > > :EndLoop
        > > ;end of clip
        > >
        > > [Non-text portions of this message have been removed]
        > >
        >
      • Sheri
        Jim, Be careful when you copy and paste a clip. Each command needs to be on one line. Word wrapping can cause lines to wrap on Yahoo (think this happened on my
        Message 3 of 7 , May 1, 2006
        • 0 Attachment
          Jim, Be careful when you copy and paste a clip. Each command needs to
          be on one line. Word wrapping can cause lines to wrap on Yahoo (think
          this happened on my latest example). In general, every line in a clip
          begins with a caret or a semicolon (otherwise it is text that gets
          entered into the current document).

          Sheri
        • essinger2001
          Thanks again Sheri. You have been a great help! Also thanks for the reminder about the message wrapping the clip lines. I might have stumbled over that one.
          Message 4 of 7 , May 1, 2006
          • 0 Attachment
            Thanks again Sheri.

            You have been a great help! Also thanks for the reminder about the
            message wrapping the clip lines. I might have stumbled over that one.
            I have been able to do all that I wanted and more in my clip. I hope
            I can find more uses for the clip programming to force me to learn more.

            Jim

            --- In ntb-clips@yahoogroups.com, "Sheri" <silvermoonwoman@...> wrote:
            >
            >
            > Hi Jim,
            >
            > Working with variables, your variable names will be surrounded with
            > percent signs. To get the value stored by a variable, prefix the
            > variable name with a caret.
            >
            > Prompting in clips is done with clip wizards. They follow a set format
            > (need to refer to the help file for clips).
            >
            > Hopefully the following example shows some basics you can use. You could
            > put in more edits on the date values, but I shouldn't think you would
            > need them assuming you'll be using the clip yourself.
            >
            > Let me know if you have any questions, there are a few comments in the
            > clip.
            >
            > Regards,
            > Sheri
          • Sheri
            Glad I could help. I m sure you ll find many uses, clips are real timesavers even if they do take a bit of working out in the beginning. I would recommend
            Message 5 of 7 , May 2, 2006
            • 0 Attachment
              Glad I could help. I'm sure you'll find many uses, clips are real
              timesavers even if they do take a bit of working out in the beginning.
              I would recommend experimenting with my clipcode syntax package. I had
              gotten a bit rusty writing clips myself, but with the clipcode syntax
              clip I was able to get right back into it.

              http://groups.yahoo.com/group/ntb-clips/files/ClipcodeSyntax_v4.02.zip
              <http://groups.yahoo.com/group/ntb-clips/files/ClipcodeSyntax_v4.02.zip>

              Take care,
              Sheri

              --- In ntb-clips@yahoogroups.com, "essinger2001" <Dilbernator@...>
              wrote:
              >
              > Thanks again Sheri.
              >
              > You have been a great help! Also thanks for the reminder about the
              > message wrapping the clip lines. I might have stumbled over that one.
              > I have been able to do all that I wanted and more in my clip. I hope
              > I can find more uses for the clip programming to force me to learn
              more.
              >
              > Jim
              >




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