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

Re: [Clip] Re: (not always) Working Replace clip!

Expand Messages
  • hsavage
    ... Hugo, Sheri, Although the Wizard Combo box looks neatest, it does present certain problems that are difficult to overcome. OTOH, character substitution is
    Message 1 of 2 , Jul 11, 2002
      > hpaulissen wrote:
      >
      > Hi sheri,
      >
      > > If any of the prior s/r items has an unmatched
      > > curly brace
      > >
      > > lot of extraneous text from unchosen s/r lines in it.
      >
      > Join the club ;-)
      >
      > ("I'm only having problems with { and }
      > appearing in the wizards
      >
      > I'm not sure it has to do with matching or non matching. The first
      > curly brace "}" just is recognised as the end of the wizard. That's
      > why I like Harveys approach better (you can insert all characters
      > without difficulties in a plain document)...
      >
      > Regards,
      >
      > Hugo
      >
      Hugo, Sheri,

      Although the Wizard Combo box looks neatest, it does present certain
      problems that are difficult to overcome.

      OTOH, character substitution is not needed using a blank document. I
      made a couple of mods to the original clip, in addition to writing a
      clip line for you, it can be used as a versatile Search/Replace engine also.

      I'm sure any interested users have tried mods already. Alec, I think,
      added S/R line numbering and it looked neat. I went that way for a while
      because it did look neat and orderly, but, you were restricted to the
      search/replace data without adding a lot more to the clip.

      The latest edition doesn't use dataline Numbering, you have access to
      the s/r data and also, data from any other open file in NoteTab, or, you
      can type your own s/r data on blank lines.

      I'm attaching the latest I have in 2 forms, normal text with a blank
      line under each long line, w/linewraps etc., second, in a formatted form
      with an un-formatting clip so you don't have to worry about linewraps,
      just read the small clip comments first.

      Also considering an addition to wizard to determine which of the 2 above
      actions to perform.

      hrs
      --------------------
      H="S/R"
      ^!ClearVariables
      ^!ProgIniSave
      ^!Set %di_1%=^$GetDocIndex(^##)$
      ^!Menu File/New
      ^!Set %di_2%=^$GetDocIndex(^##)$
      ^!Info [L]1. Select Search/Replace entries from the list^p2. Type and
      Select your own^p3. Choose entries from another file.^p^pPress^p 'CTRL'
      after the 'SEARCH' Selection^p 'SHIFT' after the 'REPLACE' Selection.
      ;
      ^!SetWordWrap 0
      ^!Set %SearchListCount%=^$GetValue("ReplaceDialog:SearchListCount")$
      ^!Set %ReplaceListCount%=^$GetValue("ReplaceDialog:ReplaceListCount")$
      ^!InsertText ‡——SEARCH DATA, ^%SearchListCount% ITEMS——‡^%nl%
      ^!Set %count%=0
      :SEARCHLISTCOUNT
      ^!Inc %count%
      ^!InsertCode
      ^$UseTokens(^$GetValue("ReplaceDialog:SearchList_^%count%")$)$^%nl%
      ;
      ^!If ^%count% = ^%SearchListCount% NEXT ELSE SEARCHLISTCOUNT
      ^!InsertText ‡——REPLACE DATA, ^%ReplaceListCount% ITEMS——‡^%nl%
      ^!Set %count%=0
      :REPLACELISTCOUNT
      ^!Inc %count%
      ^!InsertCode
      ^$UseTokens(^$GetValue("ReplaceDialog:ReplaceList_^%count%")$)$^%nl%
      ;
      ^!If ^%count% = ^%ReplaceListCount% NEXT ELSE REPLACELISTCOUNT
      ^!Jump 1
      :SET_SEARCH
      ^!SetHintInfo Select SEARCH data and Press CtrlKey
      ^!IfFalse ^$IsCtrlKeyDown$ SET_SEARCH
      ^!Set %search%=^$GetSelection$
      ^!If ^$StrCopyRight(^%search%;2)$ = ^%nl% ^!Set
      %search%=^$StrDeleteRight(^%search%;2)$
      ;
      ^!Jump Select_Start
      :SET_REPLACE
      ^!SetHintInfo Select REPLACE data and Press ShiftKey
      ^!IfFalse ^$IsShiftKeyDown$ SET_REPLACE
      ^!Set %replace%=^$GetSelection$
      ^!If ^$StrCopyRight(^%replace%;2)$ = ^%nl% ^!Set
      %replace%=^$StrDeleteRight(^%replace%;2)$
      ;
      ^!Jump Select_Start
      ^!SetDocIndex ^%di_2%
      ^!Close DISCARD
      ^!SetDocIndex ^%di_1%
      :SET_PARAMETERS
      ^!SetListDelimiter ;
      ^!Set %options%=^?{(T=A;H=11)REPLACE DATA;==WITHIN WORDS^=T|WHOLE
      WORDS^=C|_IGNORE CASE^=I|SEARCH BACKWARDS^=B|ALL OPEN DOCUMENTS^=G|WHOLE
      DOCUMENT^=W|WITHIN SELECTION^=H|REGULAR EXPRESSION^=R|_SILENT
      SEARCH^=S|ALL OCCURRENCES^=A}
      ;
      ^!Set %options%=^$StrReplace(";";^%empty%;^%options%;0;0)$
      ^!SetClipboard ^!Replace "^%search%" >> "^%replace%" ^%options%^%nl%
      ;^!Replace "^%search%" >> "^%replace%" ^%options%^%nl%

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

      H="ECW_RESTORE"
      ; ***IMPORTANT***
      ; SIMPLEST METHOD
      ;
      ; COPY BOTH THESE
      ; CLIPS TO A BLANK DOC.
      ;
      ; CUT FIRST CLIP TO THE CLIPBOARD,
      ; ADD/PASTE INTO ANY CLIPBOOK!
      ;
      ; RUN THIS CLIP ON THE REMAINING
      ; TEXT TO DE-FORMAT!
      ;
      ; THEN PASTE EXPANDED CLIP INTO CLIPBOOK
      ;
      ^!Clearvariables
      ^!SetWordwrap 0
      ^!SetScreenUpdate 0
      ^!ToolBar E-Mail UnQuote
      ^!Replace "^p" >> "" TIWSA
      ^!Replace "ºtº" >> "^t" TIWSA
      ^!Replace "ºsº" >> " " TIWSA
      ^!Replace "ºrº" >> "^p" TIWSA
      ^!Replace "ºcº" >> "^" TIWSA
      ^!Replace ºr~ >> "^p" tiwsa


      H="S/R"ºrººcº!ClearVariablesºrººcº!ProgIniSav
      eºrººcº!Setºsº%di_1%=ºcº$GetDocIndex(ºcº##)$º
      rººcº!MenuºsºFile/Newºrººcº!Setºsº%di_2%=ºcº$
      GetDocIndex(ºcº##)$ºrººcº!Infoºsº[L]1.ºsºSele
      ctºsºSearch/Replaceºsºentriesºsºfromºsºtheºsº
      listºcºp2.ºsºTypeºsºandºsºSelectºsºyourºsºown
      ºcºp3.ºsºChooseºsºentriesºsºfromºsºanotherºsº
      file.ºcºpºcºpPressºcºpºsº'CTRL'ºsººsºafterºsº
      theºsº'SEARCH'ºsºSelectionºcºpºsº'SHIFT'ºsºaf
      terºsºtheºsº'REPLACE'ºsºSelection.ºrººcº!SetW
      ordWrapºsº0ºrººcº!Setºsº%SearchListCount%=ºcº
      $GetValue("ReplaceDialog:SearchListCount")$ºr
      ººcº!Setºsº%ReplaceListCount%=ºcº$GetValue("R
      eplaceDialog:ReplaceListCount")$ºrººcº!Insert
      Textºsº‡——SEARCHºsºDATA,ºsººcº%SearchListCoun
      t%ºsºITEMS——‡ºcº%nl%ºrººcº!Setºsº%count%=0ºrº
      :SEARCHLISTCOUNTºrººcº!Incºsº%count%ºrººcº!In
      sertCodeºsººcº$UseTokens(ºcº$GetValue("Replac
      eDialog:SearchList_ºcº%count%")$)$ºcº%nl%ºrºº
      cº!Ifºsººcº%count%ºsº=ºsººcº%SearchListCount%
      ºsºNEXTºsºELSEºsºSEARCHLISTCOUNTºrººcº!Insert
      Textºsº‡——REPLACEºsºDATA,ºsººcº%ReplaceListCo
      unt%ºsºITEMS——‡ºcº%nl%ºrººcº!Setºsº%count%=0º
      rº:REPLACELISTCOUNTºrººcº!Incºsº%count%ºrººcº
      !InsertCodeºsººcº$UseTokens(ºcº$GetValue("Rep
      laceDialog:ReplaceList_ºcº%count%")$)$ºcº%nl%
      ºrººcº!Ifºsººcº%count%ºsº=ºsººcº%ReplaceListC
      ount%ºsºNEXTºsºELSEºsºREPLACELISTCOUNTºrººcº!
      Jumpºsº1ºrº:SET_SEARCHºrººcº!SetHintInfoºsºSe
      lectºsºSEARCHºsºdataºsºandºsºPressºsºCtrlKeyº
      rººcº!IfFalseºsººcº$IsCtrlKeyDown$ºsºSET_SEAR
      CHºrººcº!Setºsº%search%=ºcº$GetSelection$ºrºº
      cº!Ifºsººcº$StrCopyRight(ºcº%search%;2)$ºsº=º
      sººcº%nl%ºsººcº!Setºsº%search%=ºcº$StrDeleteR
      ight(ºcº%search%;2)$ºrººcº!JumpºsºSelect_Star
      tºrº:SET_REPLACEºrººcº!SetHintInfoºsºSelectºs
      ºREPLACEºsºdataºsºandºsºPressºsºShiftKeyºrººc
      º!IfFalseºsººcº$IsShiftKeyDown$ºsºSET_REPLACE
      ºrººcº!Setºsº%replace%=ºcº$GetSelection$ºrººc
      º!Ifºsººcº$StrCopyRight(ºcº%replace%;2)$ºsº=º
      sººcº%nl%ºsººcº!Setºsº%replace%=ºcº$StrDelete
      Right(ºcº%replace%;2)$ºrººcº!JumpºsºSelect_St
      artºrººcº!SetDocIndexºsººcº%di_2%ºrººcº!Close
      ºsºDISCARDºrººcº!SetDocIndexºsººcº%di_1%ºrº:S
      ET_PARAMETERSºrººcº!SetListDelimiterºsº;ºrººc
      º!Setºsº%options%=ºcº?{(T=A;H=11)REPLACEºsºDA
      TA;==WITHINºsºWORDSºcº=T|WHOLEºsºWORDSºcº=C|_
      IGNOREºsºCASEºcº=I|SEARCHºsºBACKWARDSºcº=B|AL
      LºsºOPENºsºDOCUMENTSºcº=G|WHOLEºsºDOCUMENTºcº
      =W|WITHINºsºSELECTIONºcº=H|REGULARºsºEXPRESSI
      ONºcº=R|_SILENTºsºSEARCHºcº=S|ALLºsºOCCURENCE
      Sºcº=A}ºrººcº!Setºsº%options%=ºcº$StrReplace(
      ";";ºcº%empty%;ºcº%options%;0;0)$ºrººcº!SetCl
      ipboardºsººcº!Replaceºsº"ºcº%search%"ºsº>>ºsº
      "ºcº%replace%"ºsººcº%options%ºcº%nl%ºrº;ºcº!R
      eplaceºsº"ºcº%search%"ºsº>>ºsº"ºcº%replace%"º
      sººcº%options%ºcº%nl%ºrº
    • Alan C.
      Hi everyone, I had the idea to bring the items up inside an info box with a numbered line to represent for each search item as well as each replace item. And,
      Message 2 of 2 , Jul 11, 2002
        Hi everyone,

        I had the idea to bring the items up inside an info box with a numbered line to represent for each search item as well as each replace item. And, next, up comes a wizard with only those (representative) numbers in it of which you choose a number.

        In that way, the code (chars with special meaning) itself thus is not to be displayed inside a wizard. (not that it can't be done with NTB but it does become more challenging to do so)

        But I like Harvey's approach even better - that is, to just show it in a doc.

        Since I'm lazy, (just click on a line instead of select an item) I might be tempted to add Select LINE to Harvey's

        ^!Select LINE
        ^!Set %search%=^$GetSelection$

        ^!Select LINE
        ^!Set %replace%=^$GetSelection$

        Thanks!! Alan.
      Your message has been successfully submitted and would be delivered to recipients shortly.