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

15004Re: Clip or Script to strip headings from a file

Expand Messages
  • Sheri
    May 1 7:32 AM
    • 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]
      > >
      >
    • Show all 7 messages in this topic