Inserting the filename at the top of 100 files
Posted: Mon Nov 13, 2000 2:32 pm
Greetings,
I would like to insert the name of the file with a carriage return at the beginning of the first line for all 142 files that I have open.
Two failed methods:
a) By using a macro, I can do an Edit > Insert > Filename all right, but the macro recorder does not capture "Next Window" navigation which would be necessary to set up the initial conditions for re-executing it. There also is no macro execution scope covering all open documents. And as others have noted, TextPad macros, unaccountably, will not close documents -- which would have obviated window navigation.
b) The Regular Expresions feature seems to preclude a pattern that matches all the text in a multiline document (a Select All). That would permit entering text to begin every file followed by "&" which substitutes all the matched text. I can trick TextPad into selecting all by replacing the RE:\n with ^^^ which forces all onto one line which can then be matched with ^.* However, there is no way to insert the dynamic filename into the replacement string. (The &f header macro would do quite nicely.)
My last resort is to use Microsoft Word and its built-in VBA to navigate my list of files: open the next file, insert the filename, close the file.
But surely TextPad will offer me an escape from the ignominy of using so monstrous a sledgehammer on so minute a gnat?
Thanks in advance for any advice!
Roy Beatty
I would like to insert the name of the file with a carriage return at the beginning of the first line for all 142 files that I have open.
Two failed methods:
a) By using a macro, I can do an Edit > Insert > Filename all right, but the macro recorder does not capture "Next Window" navigation which would be necessary to set up the initial conditions for re-executing it. There also is no macro execution scope covering all open documents. And as others have noted, TextPad macros, unaccountably, will not close documents -- which would have obviated window navigation.
b) The Regular Expresions feature seems to preclude a pattern that matches all the text in a multiline document (a Select All). That would permit entering text to begin every file followed by "&" which substitutes all the matched text. I can trick TextPad into selecting all by replacing the RE:\n with ^^^ which forces all onto one line which can then be matched with ^.* However, there is no way to insert the dynamic filename into the replacement string. (The &f header macro would do quite nicely.)
My last resort is to use Microsoft Word and its built-in VBA to navigate my list of files: open the next file, insert the filename, close the file.
But surely TextPad will offer me an escape from the ignominy of using so monstrous a sledgehammer on so minute a gnat?
Thanks in advance for any advice!
Roy Beatty