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

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

Expand Messages
  • Sheri
    May 1, 2006
      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


      ^!Set %repdate%="^$GetDate(mm/dd/yyyy)$"
      ^!Set %repdate%="^?{(M="00/00/0000";x;0) Please enter date in mm/dd/yyyy
      ^!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
      ^!Info Bad Month: "^%mo%" or Bad Day: "^%day%"
      ^!Goto StartWiz
      ^!Info Not in Range 01/01/1999..12/31/2006: ^%repdate%
      ^!Goto StartWiz
      ;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@...>
      > 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
      > > what your clip is doing (until it does what you need). As is, this
      > > will find "2006", select 7 lines including the one the 2006 is on,
      > > delete those lines. You can copy the following lines to the
      > > and then add them as a new clip to your clip library by right
      > > 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
      > > Search and Replace dialog or a clip with a single ^!Replace command.
      > >
      > > Aside from the ^!Setdebug command, it is useful to know that
      > > start with a semicolon, and to stop a runaway clip you press
      > >
      > > 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