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

Re: Clip: Save Search & Replace as clip

Expand Messages
  • hpaulissen
    Hi Alan and Sheri, This afternoon at work I saw your previous posts on the S&R clip. Nice job. I started off something similar myself, just for fun, and I
    Message 1 of 10 , Jul 3 3:41 PM
      Hi Alan and Sheri,

      This afternoon at work I saw your previous posts on the S&R clip.
      Nice job. I started off something similar myself, just for fun, and I
      didn't have your examples with me, so here is another approach. I
      didn't test your latest contributions (about to go to bed), but maybe
      you can find something useful in the following. I use UseTokens in
      the wizards, and that works. I'm only having problems with { and }
      appearing in the wizards (I guess if these appear in the ini, they
      are interpreted as some clipcode).

      Although I liked Alan's approach to show all values at once (no
      scrolling), I opted for scrollable lists with the possibility to
      enter a new value in Search / Replace.


      :Start
      ^!ProgIniSave
      ^!Set %ChangedKey%=0
      ^!Set %Count%=1
      ^!Set %Key%=Search
      ^!Set %^%Key%List%=""
      ^!Set %Text%=""
      :LISTS
      ^!Set %Value%=^$GetValue(ReplaceDialog:^%Key%List_^%Count%)$
      ^!IfTrue ^$IsEMPTY(^%Value%)$ CHANGEKEY
      ^!Append %^%Key%List%=^%Value%|
      ^!INC %Count%
      ^!GoTO LISTS
      :CHANGEKEY
      ^!IfTrue ^%ChangedKey% END
      ^!Set %ChangedKey%=1
      ^!Set %Count%=1
      ^!Set %Key%=Replace
      ^!Set %^%Key%List%=""
      ^!GoTO LISTS
      :END
      ^!Append %Text%=^!Replace "^?{Search=^$UseTokens(^%SearchList%)$}"
      >> "^?{Replace=^$UseTokens(^%ReplaceList%)$}"
      ^!Append %Text%= ^?{Regular Expression?==Regular
      Expression^=R|_No^=|Search Backwards (not for RegEx)^=B}
      ^!Append %Text%=^?{Search Where?==All open documents^=G|_Whole
      Document^=W|Only Within Hihglighted Selection^=H}
      ^!Append %Text%=^?{Silent Search?==_Yes^=S|No^=}
      ^!Append %Text%=^?{Replace All Occurences?==_Yes^=A|No^=}
      ^!InsertText ^%Text%


      Hugo
    • hsavage
      ... Hello Alan, Sheri, Hugo and any other interested parties, Several have taken a try at some variation of this replace dialog clips. I thought I might take
      Message 2 of 10 , Jul 6 1:53 PM
        > Alan C wrote:
        >
        > (*New* much better replace dialog clip enclosed below too)
        > ---
        > I had said
        >
        > I need help with check box wizard.
        >
        > H="replace dialog 2clips"
        > ^!ClearVariables
        > ^!Set %SrchLstCnt%=^$GetValue("ReplaceDialog:SearchListCount")$
        >
        >
        > Regards. Alan.


        Hello Alan, Sheri, Hugo and any other interested parties,

        Several have taken a try at some variation of this replace dialog
        clips. I thought I might take a shot. This clip handles the special
        characters, |, ^p, ^t, etcetera.

        This clip might be modified to fit into the cliphelp library but that
        wasn't my goal. I'm trying for versatility in writing a clip ^!Replace
        command string as was originally attempted.

        This clip works without a combo box except for selecting the
        find-replace options. It gives you full access to all the s/r strings
        stored in NotePro.ini and you can gather s/r strings from other open
        files if you need to.

        Run this clip, it first displays all s/r strings from the .ini in a new
        blank doc. You can choose your search data from either the search or
        replace side, same for the replace data. You can type new data into the
        doc or you can switch to other open files for search-replace data also.

        The clip does require slightly more user involvement than just mouse clicks.

        After selecting the Search data the user presses the CtrlKey, then user
        selects Replace data amd presses the ShiftKey. At this point you get a
        combo checkbox for selecting s/r options, 5 options are preselected.

        I'm adding the clip on in 2 forms, first is a straight clip with a blank
        line under it for easy identification in case of email wrapping.

        Second form is formatted for sending thru email and the small clip at
        it's top is for de-formatting the large clip. Just follow the
        instructions in the small clip comments.


        hrs

        ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
        regular clip, hope it isn't wrapped too much.


        H="SEARCH/REPLACE DIALOGS"
        ^!ClearVariables
        ^!Menu File/New
        ^!SetWordWrap 0
        ^!Set %di%=^$GetDocIndex(^##)$
        ^!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 ^p>>>-REPLACE DATA, ^%ReplaceListCount% ITEMS.^%nl%
        ^!Set %count%=0
        :REPLACELISTCOUNT
        ^!Inc %count%
        ^!InsertCode
        ^$UseTokens(^$GetValue("ReplaceDialog:ReplaceList_^%count%")$)$^%nl%
        ;
        ^!If ^%count% = ^%ReplaceListCount% NEXT ELSE ReplaceListCount
        :SET_SEARCH
        ^!SetHintInfo Select SEARCH data and Press CtrlKey
        ;^!StatusShow Select SEARCH data and Press CtrlKey
        ^!IfFalse ^$IsCtrlKeyDown$ SET_SEARCH
        ^!Set %search%=^$GetSelection$
        ^!If ^$StrCopyRight(^%search%;2)$ = ^%nl% ^!Set
        %search%=^$StrDeleteRight(^$GetSelection$;2)$
        ;
        ^!Jump Select_Start
        :SET_REPLACE
        ^!SetHintInfo Select REPLACE data and Press ShiftKey
        ;^!StatusShow Select REPLACE data and Press ShiftKey
        ^!IfFalse ^$IsShiftKeyDown$ SET_REPLACE
        ^!Set %replace%=^$GetSelection$
        ^!If ^$StrCopyRight(^%replace%;2)$ = ^%nl% ^!Set
        %replace%=^$StrDeleteRight(^$GetSelection$;2)$
        ;
        ^!Jump Select_Start
        ^!SetDocIndex ^%di%
        :SET_PARAMETERS
        ^!SetListDelimiter ;
        ^!Set %Params%=^?{(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 %params%=^$StrReplace(";";^%empty%;^%params%;0;0)$
        ^!SetClipboard ^!Replace "^%search%" >> "^%replace%" ^%params%^%nl%
        ^!Close DISCARD

        ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
        email formatted clips


        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="SEARCH/REPLACEºsºDIALOGS"ºrººcº!ClearVaria
        blesºrººcº!MenuºsºFile/Newºrººcº!SetWordWrapº
        sº0ºrººcº!Setºsº%di%=ºcº$GetDocIndex(ºcº##)$º
        rººcº!Setºsº%SearchListCount%=ºcº$GetValue("R
        eplaceDialog:SearchListCount")$ºrººcº!Setºsº%
        ReplaceListCount%=ºcº$GetValue("ReplaceDialog
        :ReplaceListCount")$ºrººcº!InsertTextºsº>>>-S
        EARCHºsºDATA,ºsººcº%SearchListCount%ºsºITEMS.
        ºcº%nl%ºrººcº!Setºsº%count%=0ºrº:SEARCHLISTCO
        UNTºrººcº!Incºsº%count%ºrººcº!InsertCodeºsººc
        º$UseTokens(ºcº$GetValue("ReplaceDialog:Searc
        hList_ºcº%count%")$)$ºcº%nl%ºrººcº!Ifºsººcº%c
        ount%ºsº=ºsººcº%SearchListCount%ºsºNEXTºsºELS
        EºsºSearchListCountºrººcº!InsertTextºsººcºp>>
        >-REPLACEºsºDATA,ºsººcº%ReplaceListCount%ºsºI
        TEMS.ºcº%nl%ºrººcº!Setºsº%count%=0ºrº:REPLACE
        LISTCOUNTºrººcº!Incºsº%count%ºrººcº!InsertCod
        eºsººcº$UseTokens(ºcº$GetValue("ReplaceDialog
        :ReplaceList_ºcº%count%")$)$ºcº%nl%ºrººcº!Ifº
        sººcº%count%ºsº=ºsººcº%ReplaceListCount%ºsºNE
        XTºsºELSEºsºReplaceListCountºrº:SET_SEARCHºrº
        ºcº!SetHintInfoºsºSelectºsºSEARCHºsºdataºsºan
        dºsºPressºsºCtrlKeyºrº;ºcº!StatusShowºsºSelec
        tºsºSEARCHºsºdataºsºandºsºPressºsºCtrlKeyºrºº
        cº!IfFalseºsººcº$IsCtrlKeyDown$ºsºSET_SEARCHº
        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º$StrDeleteRigh
        t(ºcº$GetSelection$;2)$ºrººcº!JumpºsºSelect_S
        tartºrº:SET_REPLACEºrººcº!SetHintInfoºsºSelec
        tºsºREPLACEºsºdataºsºandºsºPressºsºShiftKeyºr
        º;ºcº!StatusShowºsºSelectºsºREPLACEºsºdataºsº
        andºsºPressºsºShiftKeyºrººcº!IfFalseºsººcº$Is
        ShiftKeyDown$ºsºSET_REPLACEºrººcº!Setºsº%repl
        ace%=ºcº$GetSelection$ºrººcº!Ifºsººcº$StrCopy
        Right(ºcº%replace%;2)$ºsº=ºsººcº%nl%ºsººcº!Se
        tºsº%replace%=ºcº$StrDeleteRight(ºcº$GetSelec
        tion$;2)$ºrººcº!JumpºsºSelect_Startºrººcº!Set
        DocIndexºsººcº%di%ºrº:SET_PARAMETERSºrººcº!Se
        tListDelimiterºsº;ºrººcº!Setºsº%Params%=ºcº?{
        (T=A;H=11)REPLACEºsºDATA;==_WithinºsºWordsºcº
        =T|Wholeºsºwordsºcº=C|_Ignoreºsºcaseºcº=I|Sea
        rchºsºbackwardsºcº=B|ALLºsºopenºsºdocumentsºc
        º=G|_Wholeºsºdocumentºcº=W|Withinºsºselection
        ºcº=H|RegularºsºExpressionºcº=R|_Silentºsºsea
        rchºcº=S|_ALLºsºoccurrencesºcº=A}ºrººcº!Setºsº
        %params%=ºcº$StrReplace(";";ºcº%empty%;ºcº%pa
        rams%;0;0)$ºrººcº!SetClipboardºsººcº!Replaceº
        sº"ºcº%search%"ºsº>>ºsº"ºcº%replace%"ºsººcº%p
        arams%ºcº%nl%ºrººcº!CloseºsºDISCARDºrº
      • h.paulissen@facburfdcw.unimaas.nl
        Harvey, (& Sheri & Alan) Very nice clip, thank you... I ve changed a tiny bit in your clip, so that also after nothing is selected in Search and Replace (CTRL
        Message 3 of 10 , Jul 8 3:18 AM
          Harvey, (& Sheri & Alan)

          Very nice clip, thank you... I've changed a tiny bit in your clip, so that
          also after nothing is selected in Search and Replace (CTRL and SHIFT) there
          will be no errormessage... (And you can now interrupt the clip with
          CTRL+ALT).

          I also inserted the proginisave to reflect the latest s+r patterns and a
          line underneath the "headers". A number is inserted in front of the
          ini-lines as well... (makes it a bit more readable, imho)

          Hugo

          ^!ClearVariables
          ^!ProgIniSave
          ^!Menu File/New
          ^!SetWordWrap 0
          ^!Set %di%=^$GetDocIndex(^##)$
          ^!Set %SearchListCount%=^$GetValue("ReplaceDialog:SearchListCount")$
          ^!Set %ReplaceListCount%=^$GetValue("ReplaceDialog:ReplaceListCount")$
          ^!InsertText >>>-SEARCH DATA, ^%SearchListCount%
          ITEMS.^%nl%---------------------------^%nl%
          ;
          ^!Set %count%=0
          :SEARCHLISTCOUNT
          ^!Inc %count%
          ^!InsertCode ^%Count%:
          ^$UseTokens(^$GetValue("ReplaceDialog:SearchList_^%count%")$)$^%nl%
          ^!If ^%count% = ^%SearchListCount% NEXT ELSE SearchListCount
          ^!InsertText ^p>>>-REPLACE DATA, ^%ReplaceListCount%
          ITEMS.^%nl%---------------------------^%nl%
          ;^!Set %count%=0
          :REPLACELISTCOUNT
          ^!Inc %count%
          ^!InsertCode ^%Count%:
          ^$UseTokens(^$GetValue("ReplaceDialog:ReplaceList_^%count%")$)$^%nl%
          ^!If ^%count% = ^%ReplaceListCount% NEXT ELSE ReplaceListCount
          ;^!GoTo END
          :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
          ;^!StatusShow 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%
          :SET_PARAMETERS
          ^!SetListDelimiter ;
          ^!Set %Params%=^?{(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 %params%=^$StrReplace(";";^%empty%;^%params%;0;0)$
          ^!SetClipboard ^!Replace "^$strDeleteLeft(^%search%;3)$" >>
          "^$strDeleteLeft(^%replace%;3)$" ^%params%^%nl%
          ;
          ^!Close DISCARD


          >
          > This clip works without a combo box except for selecting the
          > find-replace options. It gives you full access to all the
          > s/r strings
          > stored in NotePro.ini and you can gather s/r strings from other open
          > files if you need to.
          >
          > Run this clip, it first displays all s/r strings from the
          > .ini in a new
          > blank doc. You can choose your search data from either the search or
          > replace side, same for the replace data. You can type new
          > data into the
          > doc or you can switch to other open files for search-replace
          > data also.
          >
          > The clip does require slightly more user involvement than
          > just mouse clicks.
          >
          > After selecting the Search data the user presses the CtrlKey,
          > then user
          > selects Replace data amd presses the ShiftKey. At this point
          > you get a
          > combo checkbox for selecting s/r options, 5 options are preselected.
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.