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

Clip to Load Replace Dialog (Repost with minor fixes)

Expand Messages
  • Sheri
    This clip can be viewed and copied without broken lines around: http://groups.yahoo.com/group/ntb-clips/messages/8973?expand=1 H= Load Replace Dialog
    Message 1 of 8 , Sep 4, 2002
    • 0 Attachment
      This clip can be viewed and copied without broken lines around:

      http://groups.yahoo.com/group/ntb-clips/messages/8973?expand=1

      H="Load Replace Dialog"
      ;08/20/2002 by Sheri Pierce
      ;09/04/2002 posted with minor fixes
      ;not compatible with Notetab versions less than 4.91.
      ;Capslock freeware http://www.rjlsoftware.com/software/utility/capslock/default.shtml
      ^!ShellWait Capslock off
      ^!Select Line
      ^!SetListDelimiter ¶ >> ¶
      ^!Set %SRTexts%=^$StrReplace(""";"¶";"^$GetSelection$";False;False)$
      ^!Set %SRTexts%=^$StrReplace("^%NL%";"";"^%SRTexts%";False;False)$
      ^!SetArray %SRTexts%=^%SRTexts%
      ^!IfMatch "\^!Replace .*" "^%SRTexts1%" Replace
      ^!IfMatch "\^!Find .*" "^%SRTexts1%" Find
      ^!Goto Error
      :Replace
      ^!Set %SRTexts1%=^$StrDeleteLeft("^%SRTexts1%";11)$
      ^!If ^$StrPos("¶ ";"^%SRTexts2%";False)$=0 Skip_2
      ^!Set %SRTexts3%=^$StrTrim(^$StrDeleteLeft("^%SRTexts2%";^$StrPosRight("¶ ";"^%SRTexts2";False)$)$)$
      ^!Set %SRTexts2%=^$StrCopyLeft("^%SRTexts2%";^$StrPosRight("¶ ";"^%SRTexts2";False)$)$
      ^!Set %SRTexts2%=^$StrDeleteRight("^%SRTexts2%";1)$
      ^!Set %SRTexts1%=^$StrReplace("¶";""";^%SRTexts1%;False;False)$
      ^!Set %SRTexts2%=^$StrReplace("¶";""";^%SRTexts2%;False;False)$
      ^!If ^%SRTexts2%="^%Caret%Empty%" Next Else Skip
      ^!ClearVariable %SRTexts2%
      ^!Goto Dialog
      :Find
      ^!If ^$StrPos("¶ ";"^%SRTexts1%";False)$=0 Next Else Skip_2
      ^!ClearVariable %SRTexts3%
      ^!Goto ResFind
      ^!Set %SRTexts3%=^$StrTrim(^$StrDeleteLeft("^%SRTexts1%";^$StrPosRight("¶ ";"^%SRTexts1";False)$)$)$
      ^!Set %SRTexts1%=^$StrTrim(^$StrCopyLeft("^%SRTexts1%";^$StrPosRight("¶ ";"^%SRTexts1";False)$)$)$
      :ResFind
      ^!Set %SRTexts1%=^$StrDeleteLeft("^%SRTexts1%";8)$
      ^!If ^$StrPos("¶ ";"^%SRTexts1%";False)$=0 Next Else Skip_1
      ^!Set %SRTexts1%=^$StrDeleteRight("^%SRTexts1%";1)$
      ^!Set %SRTexts1%=^$StrReplace("¶";""";^%SRTexts1%;False;False)$
      ^!Goto Dialog
      :Dialog
      ^!Menu Search/Replace
      ^!IfAppOpen "Find and Replace" Next Else Skip_-1
      ^!FocusApp "Find and Replace"
      ^!Keyboard #^%SRTexts1%#
      ^!Keyboard TAB
      ^!Keyboard #^%SRTexts2%#
      ^!Keyboard Alt+X
      ^!Delay 1
      ^!Keyboard #-#
      :WholeWords
      ^!Delay 1
      ^!Keyboard Alt+W
      ^!Delay 1
      ^!If ^$StrPos("C";"^%SRTexts3%";False)$>0 Next Else Skip_2
      ^!Keyboard #+#
      ^!Goto Case
      ^!Keyboard #-#
      :Case
      ^!Delay 1
      ^!Keyboard Alt+C
      ^!Delay 1
      ^!If ^$StrPos("I";"^%SRTexts3%";False)$>0 Next Else Skip_2
      ^!Keyboard #-#
      ^!Goto Search
      ^!Keyboard #+#
      :Search
      ^!Delay 1
      ^!Keyboard Alt+H
      ^!Delay 1
      ^!If ^$StrPos("B";"^%SRTexts3%";False)$>0 Next Else Skip_2
      ^!Keyboard UP UP Tab
      ^!Goto Reg
      ^!If ^$StrPos("W";"^%SRTexts3%";False)$>0 Next Else Skip_2
      ^!Keyboard DOWN DOWN Tab
      ^!Goto Reg
      ^!Keyboard DOWN DOWN UP TAB
      :Reg
      ^!Delay 1
      ^!Keyboard Alt+X
      ^!Delay 1
      ^!If ^$StrPos("R";"^%SRTexts3%";False)$>0 Next Else Skip_2
      ^!Keyboard #+#
      ^!Goto AllDocs
      ^!Keyboard #-#
      :AllDocs
      ^!Delay 1
      ^!Keyboard Alt+M
      ^!Delay 1
      ^!If ^$StrPos("G";"^%SRTexts3%";False)$>0 Next Else Skip_2
      ^!Keyboard #+#
      ^!Goto Prompt
      ^!Keyboard #-#
      ^!Goto Prompt
      :Error
      ^!Prompt Line text is not a valid Find or Replace command.
      ^!Goto End
      :Prompt
      ^!Delay 1
      ^!Keyboard Tab
      ^!Delay 1
      ^!Prompt Adjust Replace Dialog options if desired, then^%nl%Switch to target document, then^%nl%Position the cursor and "Find Next" or "Replace All" as desired.^%nl%(Press OK when you understand the instructions.)
      :End
      ^!ClearVariable %SRTexts%
      ;end clip
    • Alan C.
      Hi Sheri and Everyone, ***I spent some time to make my enclosed backend package accessible for people. But, to do so, please right click over the red colored
      Message 2 of 8 , Sep 5, 2002
      • 0 Attachment
        Hi Sheri and Everyone,

        ***I spent some time to make my enclosed backend package accessible for people. But, to do so, please right click over the red colored help clip's header choose edit clip and carefully read it. Also please look carefully at the comments in the first clip below.***

        Sheri, I wrote a frontend (or backend) for your wonderful clip. Well, yours becomes the parent clip with mine gets called from yours so that must put mine as a backend to yours (hehe) :-)

        What my backend (just plug it in) (modular is fun too) does:

        1. it provides easily accessible storage 2. Easily gives ability to add (type it in) new find and replace items into the storage.

        (I'm aware the possibility Sheri may not need it. But it is something that I needed which make it convenient, expedient method for me).

        If want to utilize, then the next clipcode line insert at top of Sheri's Load Replace Dialog clip which makes it become the parent clip and mine clips become called clips, called from hers.

        ^!Clip "Prelude_4_LoadReplaceDialog"

        Two clips follow. To utilize them, copy them into the same library as Sheri's Load Replace Dialog Clip.

        H="Prelude_4_LoadReplaceDialog"
        ; #0-Opens help window
        ^!Clip "Prelude_LRD_Help"
        ; #1-Opens the storage file. Or If the file
        ; does not exist then creates the storage file
        ^!IfFileExist "^$GetScriptPath$savsrchs.ini" skip
        ^!AppendToFile "^$GetScriptPath$savsrchs.ini" ~
        ^!IfTrue ^$IsOpen("^$GetScriptPath$savsrchs.ini")$ skip
        ^!Open "^$GetScriptPath$savsrchs.ini"

        ; #2-pauses long enuf for user to either type a new entry
        ; or click on a previously completed entry
        ^!SetHintInfo Ctrl=newly typed||Alt=pre completed
        ^!Set %loopcount%=0
        :loop
        ^!Inc %loopcount%
        ^!If ^%loopcount% > 440 exit
        ^!delay 1
        ^!IfTrue ^$IsAltKeyDown$ pre_exists
        ^!IfTrue ^$IsCtrlKeyDown$ skip
        ^!Goto loop

        ; #3-If ok, proceed onward to #4.
        ; Otherwise terminate so as to begin again
        ^!Skip U pressed Ctrl (4 a newly typed entry) Continue?
        ^!Goto exit

        ; #4-select & put needed item(s) into small array
        ^!Jump LINE_START
        ^!Select EOL
        ^!SetListDelimiter ^%SPACE%>>^%SPACE%
        ^!SetArray %SRTexts%=^$GetSelection$
        ; #5-if not a 2nd item means need go to 1_find
        ^!IfFalse ^%SRTexts2% 1_find
        ; #6-a non-null #5 gets it here means a replace (inserts the code)
        ^!InsertCode ^!Replace "^%SRTexts1%" >> "^%SRTexts2%" IS
        ; #7-return to parent clip
        ^!Goto end

        :1_find
        ; #8-a null #5 sent it here to insert the find code
        ^!InsertCode ^!Find "^%SRTexts1%" IS
        ; #9-return to parent clip
        ^!Goto end

        :pre_exists
        ; #10-If ok then returns to parent clip.
        ; Otherwise, terminate so as to begin again
        ^!Skip U pressed Alt (2 use a formerly completed/saved entry) Continue?
        ^!Goto exit
        ; this is a needed line do not delete.

        H=";Prelude_LRD_Help"
        Once completed or assembled, in the same library, you'll have 3 clips (Prelude clip, Load Replace Dialog clip, and this help clip) and also the storage file.

        I've given the storage file the name: savsrchs.ini

        And this file holds or retains your replace as well as your find commands.

        Moreover, as far as this storage file goes, you can either create a new entry in it or re utilize one of its previous entries; you must place each of the file's entries on a line by itself.

        Lastly, please note that my chosen location for this file is in Notetab's scripts folder.

        Don't worry, the clip opens this storage file in typical document fashion whereby you'll view its content and type in it.

        Given that, now comes yet some more about this storage file; I'll now define and show example of in this case the meaning or definition of previous entry versus a newly typed entry.

        Simply, a previous entry is merely nothing more than a completed find or replace command.

        An example of a previous entry:

        ^!Find "the" IS

        Another example of a previous entry:

        ^!Replace "help" >> "the" IS

        An example of a newly typed find command:

        findtext

        An example of a newly typed replace command:

        findtext >> replacetext

        Also kindly please observe that the clip does convert newly typed entry into a previous entry! Easy! Just use your stored commands over and over but once in a while type a new one it gets auto converted. Play with it. You'll see.

        Tip: While viewing this help file, on keyboard, do

        shift + F12

        Do it several times and watch to see the paragraph markers and the space markers show up. With these markers on and showing, look again at the newly typed examples above. It is of the utmost importance that a newly typed replace must have the spaces and the >> exactly as the above example does.

        Note that prior to operation, the next clipcode line must be inserted at the top of the Load Replace Dialog clip.

        ^!Clip "Prelude_4_LoadReplaceDialog"

        Operation instructions: 1. Launch the Load Replace Dialog clip 2. Click ok on the help dialog. 3. you'll see the savsrchs.ini document 4. type a new or newly typed find or replace as per above example. 5. Momentarily strike Ctrl key.

        Alternatively, you may do steps 1 through 3 above and then click on a previous entry then momentarily strike the Alt key.

        So, Ctrl key is used in conjunction with a newly typed. And the Alt key is used in conjunction with a previous entry.

        Have fun! Be lazy and let NoteTab do the work!
        end of Prelude_LRD_Help clip

        --
        Regards. Alan.
      • silvermoonwoman2001
        Hi Alan, Good idea, your savesrchs.ini file. I m modifying my previously posted clip Replace Dialog with Clip Builder to make the file one of the possible
        Message 3 of 8 , Sep 5, 2002
        • 0 Attachment
          Hi Alan,

          Good idea, your savesrchs.ini file. I'm modifying my previously
          posted clip "Replace Dialog with Clip Builder" to make the file one
          of the possible destinations.

          Rather than call your clip at the top of mine, I've put down in the
          Error label (followed by a ^!Goto Start). That way if I am on a Find
          or Replace command when I start it, it works as before. But if not,
          it calls your clip and opens the ini, etc.

          One change I made to your clip was to remove the bypass of ^!Open'ing
          the ini if it was already open. If its already open, ^!Open switches
          to the document. I also added a ^P at the end of ^!InsertCode's.

          Did you notice that " >> " 's in your red doc clip makes text go to a
          new line? Strange <g>

          Another strange thing about it, when I added your clips to my clip
          library from the clipboard the documentation clip had everything cut
          off after the first paragraph.

          So I was pretty mystified at first.

          Working fine now though, think I'm even ready to comment out
          documentation now <g>

          Regards,
          Sheri
        • Alan C.
          Hi Sheri, ... I also realized that does not need be limited (as you noticed) to just one storage file. Could have different files, each of which be a category
          Message 4 of 8 , Sep 5, 2002
          • 0 Attachment
            Hi Sheri,

            >Good idea, your savesrchs.ini file. I'm modifying my previously
            >posted clip "Replace Dialog with Clip Builder" to make the file one
            >of the possible destinations.

            I also realized that does not need be limited (as you noticed) to just one storage file. Could have different files, each of which be a category of saved searches. For example, one for programming, another for a farmer who has an apple orchard maintenance and crop terms, another for cooking or someone who cooks, and etc., etc.

            With these capabilities, we may be approaching characteristics that of a database :-)


            >Rather than call your clip at the top of mine, I've put down in the
            >Error label (followed by a ^!Goto Start). That way if I am on a Find
            >or Replace command when I start it, it works as before. But if not,
            >it calls your clip and opens the ini, etc.

            Great! At error, jump to my called clip then return to yours to then from mine be sent up to the start of yours. I may also try that.

            >Did you notice that " >> " 's in your red doc clip makes text go to a
            >new line? Strange <g>

            Yes. That's why I asked for any potential user to right click over the red header and choose edit clip so as to read it.


            >Another strange thing about it, when I added your clips to my clip
            >library from the clipboard the documentation clip had everything cut
            >off after the first paragraph.

            I wonder if the "add from clipboard" option does not allow/handle any blank lines? Normally, a clip would not have any; but this is a help clip. Maybe this an NRN issue? Or, maybe not? Or maybe I needed a semi colon on each blank line.

            --
            Regards. Alan.
          • waynemv
            ... ... Your clip ought not to require capslock . The preferred approach to pasting text into dialogs, meaing via the clipboard, is not affected by capslock
            Message 5 of 8 , Sep 12, 2002
            • 0 Attachment
              --- In ntb-clips@y..., Sheri <silvermoonwoman@c...> wrote:

              > H="Load Replace Dialog"
              > ;08/20/2002 by Sheri Pierce
              > ;09/04/2002 posted with minor fixes
              > ;not compatible with Notetab versions less than 4.91.
              > ;Capslock freeware

              ...

              > ^!FocusApp "Find and Replace"
              > ^!Keyboard #^%SRTexts1%#
              > ^!Keyboard TAB
              > ^!Keyboard #^%SRTexts2%#
              > ^!Keyboard Alt+X

              ...

              Your clip ought not to require "capslock".

              The preferred approach to pasting text into dialogs, meaing
              via the clipboard, is not affected by capslock status.

              1. Get the dialog box to open
              2. ^!ClipboardSave

              3. For each text field do these two steps.
              3.a. ^!SetClipboard text to be pasted
              3.b. ^!Keyboard ALt+N Ctrl+V

              Where Alt+N is whatever alt key moves focus to the desired field
              in the dialog. Alt+N moves to find, Alt+P moves to replace, etc.
              Ctrl+V, is to paste the text from the clipboard. When working
              programmatically, it is best to always use explicit Alt+key
              shortcuts to move between fields, rather than using the tab key.
              This means the clip is less likely to break if a new field is
              ever added to the dialog.

              4. ^!ClipboardRestore
              Whenever a clip uses the clipboard, it should be sure to
              remember and restore the user's clipboard contents.


              Working with the Find and Replace Dialogs require a bit more
              effort though. They automatically quote special characters that
              are pasted, if the RegExpression box is checked. If this is a
              problem, the solution is to uncheck the RegEx box first, paste
              the text, then recheck RegEx.

              ; UnCheck RegularExpression in Find/Replace dialogs
              ^!Keyboard Alt+X -

              ; Check RegularExpression in Find/Replace dialogs
              ^!Keyboard Alt+X +



              By the way, I have been very impressed by several of your clips
              lately. Especially your nearly perfect one liner for breaking
              lines at 80 col.

              --
              Wayne VanWeerthuizen
              NoteTab Clip Quality Control Services
            • Sheri
              Posting to this group might be broken, I posted awhile ago and nothing showed up. Sorry, this is a repeat: Hi Wayne, Quite right, that would have avoided the
              Message 6 of 8 , Sep 12, 2002
              • 0 Attachment
                Posting to this group might be broken, I posted awhile ago and
                nothing showed up. Sorry, this is a repeat:

                Hi Wayne,

                Quite right, that would have avoided the need for a separate
                utility. However, there are still times that I want to use
                ^!Keyboard to type variable contents (Ctrl-V doesn't always
                work), and its disturbing when you get unexpected results because
                capslock happens to be on. So the capslock utility will come in
                handy until and unless Notetab addresses the issue.

                BTW, I haven't seen you at the newish group at
                http://groups.yahoo.com/group/ntb-scripts

                It is being used to post clips that need testing or that might go
                through a few iterations before being finalized and posted on the
                clips list. It would be a good place for someone interested in
                Clip Quality Control <g>

                > By the way, I have been very impressed by several of your clips
                > lately. Especially your nearly perfect one liner for breaking
                > lines at 80 col.

                Thanks. A little encouragement means alot <g>

                Regards,
                Sheri
              • waynemv
                ... Somehow I missed notice of that group being created. Thanks so much!
                Message 7 of 8 , Sep 12, 2002
                • 0 Attachment
                  --- In ntb-clips@y..., "Sheri" <silvermoonwoman@c...> wrote:

                  > BTW, I haven't seen you at the newish group at
                  > http://groups.yahoo.com/group/ntb-scripts

                  Somehow I missed notice of that group being created. Thanks
                  so much!
                • Jody
                  Hi Wayne, Sheri, and Others, ... I first said to myself, Self, we don t have a new wish group; it s still ntb-NextRelease. :) The ntb-scripts was a joint
                  Message 8 of 8 , Sep 12, 2002
                  • 0 Attachment
                    Hi Wayne, Sheri, and Others,

                    > > BTW, I haven't seen you at the newish group at
                    > > <http://groups.yahoo.com/group/ntb-scripts>http://groups.yahoo.com/group/ntb-scripts

                    I first said to myself, "Self, we don't have a new wish group;
                    it's still ntb-NextRelease." :)

                    The ntb-scripts was a joint idea of Eric's and mine. I had been
                    thinking about it, Eric at some point recently suggested a RegExp
                    list, I replied with ntb-scripts, and a week or two later it was
                    born. ;)

                    I'm impressed with the amount of traffic on it already! We
                    thought that it may perhaps take some of the traffic off the
                    Clips list leaving it mainly for NoteTab scripts, but still allow
                    other scripting code to be posted there as well as Clip code
                    being allowed on the scripts list. My thought was also that
                    trying to keep the Clips list more pointing at Clip code might
                    not blow away/scare off some newbie Clippers. ;) Please see my
                    signature line to subscribe to it. TIA

                    Happy Script'n!
                    Jody Adair

                    UnSubscribe, Options
                    mailto:ntb-Scripts-UnSubscribe@yahoogroups.com
                    http://groups.yahoo.com/group/ntb-clipclass

                    The NoteTabbers Assistant Page
                    http://www.notetab.net
                  Your message has been successfully submitted and would be delivered to recipients shortly.