Re: [Clip] Clip to Load Replace Dialog (Repost with minor fixes)
- 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.
Two clips follow. To utilize them, copy them into the same library as Sheri's Load Replace Dialog Clip.
; #0-Opens help window
; #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
; #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
^!If ^%loopcount% > 440 exit
^!IfTrue ^$IsAltKeyDown$ pre_exists
^!IfTrue ^$IsCtrlKeyDown$ skip
; #3-If ok, proceed onward to #4.
; Otherwise terminate so as to begin again
^!Skip U pressed Ctrl (4 a newly typed entry) Continue?
; #4-select & put needed item(s) into small array
; #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
; #8-a null #5 sent it here to insert the find code
^!InsertCode ^!Find "^%SRTexts1%" IS
; #9-return to parent clip
; #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?
; this is a needed line do not delete.
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:
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.
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
- 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>
- Hi Sheri,
>Good idea, your savesrchs.ini file. I'm modifying my previouslyI 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.
>posted clip "Replace Dialog with Clip Builder" to make the file one
>of the possible destinations.
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 theGreat! 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.
>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.
>Did you notice that " >> " 's in your red doc clip makes text go to aYes. 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.
>new line? Strange <g>
>Another strange thing about it, when I added your clips to my clipI 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.
>library from the clipboard the documentation clip had everything cut
>off after the first paragraph.
- --- 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
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.
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.
NoteTab Clip Quality Control Services
- Posting to this group might be broken, I posted awhile ago and
nothing showed up. Sorry, this is a repeat:
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
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 clipsThanks. A little encouragement means alot <g>
> lately. Especially your nearly perfect one liner for breaking
> lines at 80 col.
- --- In ntb-clips@y..., "Sheri" <silvermoonwoman@c...> wrote:
> BTW, I haven't seen you at the newish group atSomehow I missed notice of that group being created. Thanks
- Hi Wayne, Sheri, and Others,
> > BTW, I haven't seen you at the newish group atI first said to myself, "Self, we don't have a new wish group;
> > <http://groups.yahoo.com/group/ntb-scripts>http://groups.yahoo.com/group/ntb-scripts
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
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
The NoteTabbers Assistant Page