Header and Footer

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
ravilobo
Posts: 18
Joined: Fri Dec 14, 2007 8:45 pm

Header and Footer

Post by ravilobo »

I have around 40 files, in which header and footer (constant string) is required. How to achieve this using regular expressions or macro?
User avatar
talleyrand
Posts: 624
Joined: Mon Jul 21, 2003 6:56 pm
Location: Kansas City, MO, USA
Contact:

Post by talleyrand »

Macro route, assuming you have no objection to repeating it 40 times.

Macros -> Record (Ctrl-Shift-R)
Ctrl-Home (resets cursor position to first line, first column)
{Insert your header material}
Ctrl+End (resets cursor position to end line, last column)
{Insert your footer material}

Macros -> Stop Record (Ctrl-Shift-R)

Save that macro out and any new documents or any existing documents can have that macro run against them. Might want to explicitly add in a carriage return (enter) before adding your header/footer.

WildEdit might have the ability to do this even easier with a regex that says "match entire document" and replace with "header"\1"footer"
I choose to fight with a sack of angry cats.
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

Can also put the header and footer into a library clip that surrounds the selected text. So, Select All, Select "Header/Footer" from Clip Library.
Hope this was helpful.............good luck,
Bob
ravilobo
Posts: 18
Joined: Fri Dec 14, 2007 8:45 pm

Post by ravilobo »

Thanks Bob. Thanks talleyrand.

As talleyrand mentioned I was looking for an option similar to - "match entire document" and replace with "header"\1"footer"
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

Both the macro and clipboard accomplish the same thing, but without using RegEx.
Hope this was helpful.............good luck,
Bob
Jam
Posts: 4
Joined: Sun Jun 29, 2008 10:47 pm

Post by Jam »

I needed to do the same thing, but I didn't want to use macro or clip library since I had to do it with 3000 files... here is the regex solution in case anyone else is in the same situation :

\A = start of file

\z = end of file

Works perfectly!
User avatar
talleyrand
Posts: 624
Joined: Mon Jul 21, 2003 6:56 pm
Location: Kansas City, MO, USA
Contact:

Post by talleyrand »

:?
Admitedly, I don't have WildEdit installed on this virtual, but those two regular expression escapes don't appear to work with TextPad.
I choose to fight with a sack of angry cats.
Jam
Posts: 4
Joined: Sun Jun 29, 2008 10:47 pm

Post by Jam »

You're right, sorry I forgot to mention that these worked with WildEdit.

I don't know if it's possible with TextPad regex, but anyway I don't think TextPad could handle 3000 files open at once, certainly not on my computer - it seems to break somewhere around 500.
Post Reply