Re: [NTB] OT: Find and Replace, Clip Resources?
- At 10:11 PM 8/31/03 +0300, you wrote:
>Hi,Jody Adair will probably moderate you for this anyway. It is not that hard
>I know this is not the clip list but I would not want to join it, yet, for
>just a couple of messages. Anyway, I was thinking of executing a couple of
>find and replace commands to the contents of the current document and it
>seems the only way to do a series of find&replace conveniently is to use the
>clip language. I wish NTP 5 would include facilities of recording a macro
>and saving it as a clip but that's another story.
>What's the syntax for using the find and replace in the clip language and
>what else do I need to add (header info, selecting only the currently active
>document etc...) to make it work?
>I'm new to the clip language but have some experience in C and a little in
>Java. Are there any clip tutorials assuming former programming experience?
>Speaking of the symbols denoting the different clip elements keywords,
>variables, functions etc... I find most of those awfully difficult to
>remember and enter not to mention somewhat illogical. Why so strange a
>special character set and is there some great logic behind it as to why it's
>what it is?
to subscribe to the correct list and then to change your settings to nomail
so that you can read your posts on the web if you wish. He tries very hard
to keep the basic list for basic questions. If a lot of posters start
topics that are over the heads of new people coming on the list, then the
new people unsubscribe and we lose them and their business and word of
mouth support for NoteTab so Jody keeps posting responses to keep posters
from discussing these topics on the basic list. I am responding by private
email for this very reason.
If you go to the menu bar and select:
Help on Clip Programming
and then select the index tab you will see a list of the clip commands in
alphabetical order and a description of each command and its syntax and how
to use it. Here is the information of the find command and the replace
^!Find "SearchText" [Options TCIBGWHRS]
Searches for the specified text. Tab and line break characters should be
replaced by their tokens (^T and ^P respectively). You can use the
following optional settings:
T: Does not search for whole words only (search string can be found within
C: Searches for whole words only.
If the options T or C are not used, NoteTab will search for whole words if
the search criteria does not contain spaces or other word delimiting
characters. If the search criteria contains such delimiters, then NoteTab
will accept matches that are not whole words.
I: Ignores character case.
B: Searches backwards.
G: Global scope; searches through all the open documents.
W: Searches through the whole document (not just from the cursor position).
H: Only searches within selection if text is highlighted (setting ignored
if no text selected).
R: Specifies that the search criteria represents a regular expression.
S: Silent search. NoteTab will not display any message box.
The following example will find the next occurrence of the word NoteTab
starting from the cursor position. If a match is not found in the current
document, the other open documents will also be searched:
^!FIND "NoteTab" G
The search criteria must always be placed between double quotes if you
don't specify search options.
^!Replace "SearchText" >> "ReplaceText" [Options TCIBGWHRSA]
^!Replace SearchText ReplaceText [Options TCIBGWHRSA]
Similar to the "^!Find" command but replaces matches with the replace
criteria. The first format uses spaces to separate parameters and the
second uses a tab character. Use one or the other but do not mix the two
formats within an instruction. You can use the following optional setting,
which is specific to the Replace command:
A: Use to replace all matched occurrences. When this option is not used,
only the first match is replaced.
The following Clip example will search all open documents and replace the
listed upper case HTML tags to their lower case equivalent:
^!Replace <B> <b> GA
^!Replace </B> </b> GA
^!Replace <I> <i> GA
^!Replace </i> </i> GA
END OF HELP ON FIND AND REPLACE:
The various systax is fairly easy to distinguish:
Every item begins with a circumflex (^) which is how the clip parser knows
that you are using a clip command, function, or variable. Otherwise, the
text is just treated as a stamper. That is, the test is just inserted line
breaks and all into the current document at the current cursor position
with no modifications at all.
Next the parser looks for a second character to tell it how to handle the
command. An exclamation character (!) tells the parser that this is a
basic clip command that performs some action based on the command and what
ever parameters it supports or requires. A dollar sign ($) tells the
parser that this is a clip function witch it must replace with specific
information based on the function and its parameters. A percent symbol (%)
tells the parser that this is a variable to be replaced by what ever has
been stored into the variable previously by another command. A question
mark (?) is used to tell the parser to stop and display and input wizard
for the clip user to enter data into the running clip to be acted on later
by clip commands in the clip. An asterisk (*) or a pound sign (#) tell the
parser that it must replace this item with the current document path/name.
And finally a ampersand (&) tells the parser to replace this item with any
text that is currently selected/highlighted in the currently open document
when the clip is run and to process it with the clip commands in the places
it occurs in the clip.
Anything else has to do with regular expressions which is a complete
subject in itself and you need to look it up in the help files to get an
understanding of it. It is a sort of search and replace wildcard language.
Please feel free to join the clips list to discuss this further. You can
join the list at:
The NoteTab Clips List............ ntb-Clips-Subscribe@yahoogroups.com
- Hello Veli-Pekka and Larry,
Thanks for all your support lately Larry!
>> I know this is not the clip list but I would not want to joinYou can sign up for any list and set your options to read the
>> it, yet, for just a couple of messages.
mail on the web, so it is not big deal to subscribe. Larry was
correct in bringing the thread to the Clips list. You can easily
sign up for the lists from a web page. (I attempted to answer your
If you sign up for any of the discussion lists, please do not
post questions about Clips and other scripting languages on the
Basic list. More difficult tasks should be posted on the Clips
or Scripts lists. HTML should be posted on the HTML list and Off
Topic discussion takes place on that list. In short, please leave
the Basic list for the very basic use of NoteTab. Thanks!!!
>> Anyway, I was thinking of executing a couple of find andThe Clip Code is unique in that commands from other script code,
>> replace commands to the contents of the current document and it
>> seems the only way to do a series of find&replace conveniently
>> is to use the clip language. I wish NTP 5 would include
>> facilities of recording a macro and saving it as a clip but
>> that's another story.
>> Speaking of the symbols denoting the different clip elements
>> keywords, variables, functions etc... I find most of those
>> awfully difficult to remember and enter not to mention
>> somewhat illogical. Why so strange a special character set and
>> is there some great logic behind it as to why it's what it is?
language, etc. can be used right in the Clips. The symbols are
really quite easy to remember. If it is ^!, then it is a
command. If it is ^$, then it is a function. I think once you
make some Clips you will understand a lot more with 20/20
The following is a download for a Clipbook programming tutorial
called "Clip Class" designed to walk you through Clip writing. It
includes "Getting Started" (which is a web page with a number of
images displaying different parts of NoteTab that deals with
Clipbooks), making a Clipbook Library, adding Clips, and editing
Clips, on to more difficult Clips writing. Be sure to read the
Introduction also. Open ClipClass.clb and then click on the
ClipClass.otl Outline Clip to open the Outline.
All the contents of the zip files go in NoteTab's Libraries
The NoteTab Clip Class List: eMail link follows below. We haven't
really been using it much at all, actually, about never for the
past year or two. I'm too busy now-a-days to keep up with it.
If you have a setup problem (above) it would be a good place to
ask that, but I think you will understand the above. The lessons
start off very basic and, even with NoteTab in general when
talking about the layout. Do the online Getting Started to see
what I mean. I think you will find it all easy to understand.
It builds, one lesson after a lesson; It is best not to skip any
of the first 5 lessons or so. After that you might be up to speed
enough to use the rest as reference.
Subscribe, UnSubscribe, Options