Search/Select Multiple Lines

Help with writing and playing macros

Search/Select Multiple Lines

Postby Skwerm » Wed Nov 08, 2006 2:43 pm

I have a text file report that is generated by some engineering software that I'm trying to insert page-breaks into at certain locations. That part is working fine, but I want to add the header (which the engineering software adds to the top of the file only) right after each new page break.

The header is followed by two blank lines at the top of the report. I thought I'd just select all the text from the top of the file to the end of the two blank lines and then copy that selection to the clipboard. I can't seem to get UE to search/select to the first occurrence of two successive blank lines. I have tried having the macro look for "%^p%^p" with no luck. UE always seems to just select the first line of the header and that's it.

Here is a sample of the header:

Code: Select all
Project:     IN20060894
Subject:
Job No.      894              Operator: DW
Date:        Tuesday  November 7, 2006  11:17 am

SYSTEM FIX 4 ASEC 2 BEAR PRI 0 RED NE STA 3 FILE: 'CHNS'
--blank line #1--
--blank line #2--  *** I want to end selection here ***


Thanks for any suggestions!
User avatar
Skwerm
Basic User
Basic User
 
Posts: 14
Joined: Mon Aug 08, 2005 11:00 pm

Re: Search/Select Multiple Lines

Postby Mofi » Thu Nov 09, 2006 1:55 pm

The function Find + Select from current cursor position till end of found string or extend current selection till end of found string seems to be overlooked by many users although it is explained at help for the Find function and the macro command Find. Here is the macro part you need:

Top
StartSelect
Find Select "^p^p^p"
Copy
EndSelect

You can use the copied header directly when you insert the page break with a find+replace. The page break has the code ^b and the code for the text in the current clipboard is ^c.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4049
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Search/Select Multiple Lines

Postby Skwerm » Thu Nov 09, 2006 2:01 pm

Thanks, Mofi!

I actually managed to figure that out before I read your post, but I wanted to thank you just the same.

I still think there's something wrong with the Find Select method I was using before, but since this other method does the trick I won't worry about it.

Cheers!!
User avatar
Skwerm
Basic User
Basic User
 
Posts: 14
Joined: Mon Aug 08, 2005 11:00 pm


Return to Macros