Re: [Clip] Pulling lines of HTML code out of a page
- Hi Andrew:
Sorry, I saw your post asking how to actually use a clip but was hoping
some one else would respond to it :-)
Here's the quick and dirty about grabbing a clip posted in this forum
and using it yourself inside of Notetab.
First: In regular Notetab Help (not the "Help on Clip programming" which
explains the syntax of clip commands) read these two topics:
<< Use the Editor Clipbook >> and <<Create Clipbook Libraries>>
The Libraries bar is down at the bottom - it is shown/hidden in
View-Libraries Bar. If its not on, turn it on.
Now on the Left side you need to show the clipbar (which shows and
allows you to execute individual clips within a library).
You can hide/show the clipbar with F4 - If its not on, turn it on.
You can add clips to an existing library, but its probably better if you
create your own library.
Right-click in the dropdown panel at top of Clipbar, select New - name
your new bar (say) "andy's library"
This will add it to the library bar at the bottom.
Ok, now to add the clip to your "andy's library":
============> Copy below this line <=======
H="Kill all but target lines"
; Alec Burgess 2006/12/10
^!replace "(?im-s)(.*^%what_to_look_for%.*)|(.*)" >> "$1" rwsai
; above leaves blank lines for all that did NOT match
; uncomment following line if you want those blank lines deleted
;^!replace "\r\n(\r\n)+" >> "" rwsai
=========> Copy above this line <==========
As indicated, copy between (but not including) the dashed lines
Return to Notetab and in the left-side clipbar, right-click and select:Add from clipboard
The above clip will be shown in the previously empty clip-pane and the [Clips] tab will open in the main edit window.
Change "the text you are looking for" in the above to what you want.
Save "Ctrl+S" in the [Clips] tab.
Load the file you want to find stuff in, double click the "Kill all but target lines" in the clip pane and you the file will be modified so only the lines you want are kept and the others are blank.
* I fixed a couple of typos I'd left in the version posted below.
* I added the line ^!setdebug ON at the top. This allows you to
single-step through the clip giving you a better idea of what each
line is doing.
o just remove it when you are sure it is working the way you
want or comment it out by putting a semicolon at the
beginning of the line.
* If you want more task oriented instructions than are in the "Help
on Clip programming" I referred to above, just search for "clip
class" the yahoo archives (with the quotes) and you'll find links
to a series of lessons that Jody wrote years ago (it stops around
lesson 10 of an originally anticipated 12 or 13)
As Jody sometimes says "Happy clip'in"
Regards ... Alec -- buralex-gmail
> Thanks Alex.[Non-text portions of this message have been removed]
> Alec Burgess wrote:
>> Ted (& Andrew from a related thread on the NTB List)
>> Here's a cleaner way to kill all but lines containing a specific word
>> or phrase no matter where it appears in the line:
>> H="Kill all but target lines"
>> ; Alec Burgess 2006/12/10
>> ^!set %what_to_look_for%="<Tr> <Th align=left>"
>> ^!replace "(?im-s)(.*%what_to_look_for%.*)|(.*" >> "$1" rwsai
>> ; above leaves blank lines for all that did NOT match
>> ; uncomment following line if you want those blank lines deleted
>> ^!replace "\r\n(\r\n)+" >> "" rwsai
>> Re yahoo-groups wrapping - all lines start with either "^!" or ";"