Removing or deleting bookmarked lines...

Help with writing and playing macros

Removing or deleting bookmarked lines...

Postby bettyt456 » Wed Jan 10, 2007 8:52 pm

This is my first query on this forum, so my apology if this question is a common one. I've used the forum search function with no luck.

Is there a way to remove or delete bookmarked lines?

Betty
User avatar
bettyt456
Newbie
 
Posts: 5
Joined: Wed Jan 10, 2007 12:00 am

Re: Removing or deleting bookmarked lines...

Postby Mofi » Thu Jan 11, 2007 8:29 am

Following macro should to that. It works only for ASCII files, not for Unicode/UTF-8 files!

InsertMode
ColumnModeOff
HexOff
Loop
Bottom
PreviousBookmark
IfEof
ExitLoop
EndIf
ToggleBookmark
DeleteLine
EndLoop
Top
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4039
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Removing or deleting bookmarked lines...

Postby bettyt456 » Thu Jan 11, 2007 7:27 pm

Wow....Mofi. Is there a page I can go to give you a donation for your help?

I would gladly do that.

I posted a question on how to create one blank spacing between paragraphs.

Is there a way to set a command to put a period after the last word of each paragraph, if there is not a period already there?

I know I'm picking brains here and I appreciate your help....as above though, I'd be happy to donate to your world for your gracious responses.

Betty
User avatar
bettyt456
Newbie
 
Posts: 5
Joined: Wed Jan 10, 2007 12:00 am

Re: Removing or deleting bookmarked lines...

Postby Bego » Thu Jan 11, 2007 8:43 pm

Hi Betty,

well, what is a paragraph in a word editor ? I suppose a new line (like when enter is pressed).
You can do a (Perl) regular expression replace to transform text like this
I got no dot
I got a dot.
I got no dot too
No dot here


into this:
I got no dot.
I got a dot.
I got no dot too.
No dot here.


via a replace:
([^.])\r\n
with
$1.\r\n

Not sure if I got you right. Pls post ALWAYS an example...

@MOFI: I blicks net. \p soll laut Online-Hilfe \r\n sein. \p tut aber net :-(
"Unzulaessiger RegExp". Idee ? UE 12.20b

rds Bego
User avatar
Bego
Master
Master
 
Posts: 357
Joined: Wed Nov 24, 2004 12:00 am
Location: Germany

Re: Removing or deleting bookmarked lines...

Postby bettyt456 » Thu Jan 11, 2007 8:50 pm

Amending this after looking at your example Bego.

Actually this is what I'm looking for. Macro(s) that will correct two things.

1) Add the dot at the end of a paragraph if one does not already exist.

2) Ensure that there is only one empty line (space or carriage return) between paragraphs.

Before Macro(s) have run:

I have no dot because this is one sentence which is part of a paragraph
and now I will place a dot. Now on this sentence I will need a dot because it is the end of this second sentence, but I forgot to put a dot when I wrote this complete paragraph



This second paragraph is three spaces apart to show an example of what my text file(s) look like presently. I also have paragraphs that are 2-4 lines or spaces between paragraphs, which I want corrected with a Macro. At the end of this paragraph I don't have dot either to show what my text files look like presently. I will be using these two paragraphs below to show the desired outcome after the Macro(s) are finished running


After the Macros have run:

I have no dot because this is one sentence which is part of a paragraph
and now I will place a dot. Now on this sentence I will need a dot because it is the end of this second sentence, but I forgot to put a dot when I wrote this complete paragraph.

This second paragraph is three spaces apart to show an example of what my text file(s) look like presently. I also have paragraphs that are 2-4 lines or spaces between paragraphs, which I want corrected with a Macro. At the end of this paragraph I don't have dot either to show what my text files look like presently. I will be using these two paragraphs below to show the desired outcome after the Macro(s) are finished running.


Cheers,
:lol:
Betty
User avatar
bettyt456
Newbie
 
Posts: 5
Joined: Wed Jan 10, 2007 12:00 am

Re: Removing or deleting bookmarked lines...

Postby Bego » Fri Jan 12, 2007 7:35 am

OK, Best you do it with 2 separate macros:

EINELeerzeile
Code: Select all
InsertMode
ColumnModeOff
HexOff
UnixReOn
Top
TrimTrailingSpaces
Loop
Find "^p^p^p"
Replace All "^p^p"
IfNotFound
ExitLoop
EndIf
EndLoop


PunktVorLeerzeil
Code: Select all
Top
Loop
Find RegExp "([^.])\p\p"
Replace "\1.\p\p"
IfNotFound
ExitLoop
EndIf
EndLoop


DOIT
Code: Select all
PlayMacro 1 "EINELeerzeile"
PlayMacro 1 "PunktVorLeerzeil"



lalala
lalalalalPunkt



lalala
lalalaPunkt.


lalala
lalalaPunkt

lalala
lalalaPunkt




After running DOIT:

lalala
lalalalalPunkt.

lalala
lalalaPunkt.

lalala
lalalaPunkt.

lalala
lalalaPunkt.




HiH. Bego

P.S. Notice the 2 empty lines at the end of your file.
Macro property "Continue if nothing found" has to be on.
User avatar
Bego
Master
Master
 
Posts: 357
Joined: Wed Nov 24, 2004 12:00 am
Location: Germany


Return to Macros