Cannot open next file when running macro wiht 100 files open

General questions about using TextPad

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

Post Reply
Nico Noordhoek

Cannot open next file when running macro wiht 100 files open

Post by Nico Noordhoek »

Hello,
I want create a macro that delete empty lines
and I want to do that in 100 files at once,
I have opened them but when make my chances in file
one and save that file, I cannot open automatically open
the next file?? The close option is grey. All this happens when
the macro is running..
Somebody any idea?

------------

Line One Line One Line One

Line Two Line Two Line Two

Line Three Line Three Line Three

And I want It to look like this:

Line One Line One Line One
Line Two Line Two Line Two
Line Three Line Three Line Three
Andreas

Re: Cannot open next file when running macro wiht 100 files

Post by Andreas »

Why not do it in all files in one go?
You say you have opened all the files.
Then record a macro that replaces
\n\n
by
\n
with regex selected and scope: All documents

You could also record the Save All into the same macro.
Nico Noordhoek

Re: Cannot open next file when running macro wiht 100 files

Post by Nico Noordhoek »

Hello Andreas,
Thanks for your reaction, it is not possible because there are more places with empty lines and don't want to chance them all.

Here a part of an file I want to chance
I wanted to make a macro that starts at K I T L V, and delete
the empty lines and stops at the end of the line that begins
with "Date" and then the macro closes this file and starts in
the next one...

Nico


-------------------

<head><title>KITLV - 1999 Daily Reports</title></head>
<body BGCOLOR="#FFFFFF">
<a name="top">
<br><b>Use ctrl + f to search this page</b>
<pre>



K I T L V Library


Daily Report of current events in Indonesia


by Herman C. Kemp


Date: 3 January 1999

==================================================================


* 1: The Siren Song of 'Autonomy'e l!
* 2: RNW Internationaal Nieuws, 31 december 1998
* 3: SiaR-->RN: PRABOWO, PEREMPUAN TIONGHOA DAN XANANA GUSMAO ADALAH
TOKOH-TOKOH TAHUN 1998
* 4: Help for Irian Jaya?
* 5: SiaR---KAPOLDA JATENG NYATAKAN TAK ADA PENJARAHAN DI PANTURA
* 6: SiaR---DALAM PEMILU 1999 KOALISI PKB-PDI AKAN HADAPI GOLKAR-PAN
* 7: MeunaSAH---DI ACEH 7 ANGGOTA ABRI TEWAS DIBANTAI
* 8: RNW Internationaal Nieuws, 30 december 1998
* 9: ISTIQLAL (29/12/98)# GUS DUR TERLALU MEMBESAR-BESARKAN KEKUATAN
SOEHARTO
Roy Beatty

Re: Cannot open next file when running macro wiht 100 files

Post by Roy Beatty »

Nico,

If your files have the same text in the same rows, you might try the following regex:<br>
Find:::: ^<head>.+\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n
Replace: (empty)

As far as navigating all the files in a directory and performing the same operation on them, try http://www.textpad.com/forum/read.php?f=1&i=323&t=323

In that thread the great Alan Bellows kindly posted some Perl code that got me started down the path of *real* scripting. If you have many requirements like you've described above, then I strongly recommend your looking into Perl or (even better) Python. You can even execute your code from within Textpad!

Use your scripts over and over to get the latest informasi on your favorite subjects!

Good luck,

Roy
Post Reply