how can I copy every 7 line and paste new file

Help with writing and playing macros

how can I copy every 7 line and paste new file

Postby subami » Fri Dec 31, 2004 8:53 am

I have a file which has so many lines.
I want to copy every 7 line text including the cursor point line, and paste the new file.
help me !

ex)

aaa
bbb
ccc ->copy <-start cursor point
dddd
www
qqqq

ccc
eee
ggg ->copy
hhh
uuu
iiiii

rrr
eee
www ->copy
qqq
aaa
ddd

and paste the new file
User avatar
subami
Newbie
 
Posts: 7
Joined: Fri Dec 31, 2004 12:00 am

Re: how can I copy every 7 line and paste new file

Postby Mofi » Sat Jan 01, 2005 6:33 am

Here it is. The green macro code is for making sure, that the end of file is after a line break. This is necessary because you will run into an endless loop, if the last line of the file does not have a line break. Nothing is changed on the source file, if it ends with a line break. The macro uses clipboard 9 for copying the data.

InsertMode
ColumnModeOff
HexOff
UnixReOff
ToggleBookmark
Bottom
IfColNum 1
Else
"
"
EndIf
PreviousBookmark
ToggleBookmark

Clipboard 9
ClearClipboard
Loop
SelectLine
StartSelect
CopyAppend
EndSelect
Key DOWN ARROW
IfEof
ExitLoop
EndIf
Key DOWN ARROW
IfEof
ExitLoop
EndIf
Key DOWN ARROW
IfEof
ExitLoop
EndIf
Key DOWN ARROW
IfEof
ExitLoop
EndIf
Key DOWN ARROW
IfEof
ExitLoop
EndIf
Key DOWN ARROW
IfEof
ExitLoop
EndIf
EndLoop
NewFile
Paste
Top
ClearClipboard
Clipboard 0
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4062
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: how can I copy every 7 line and paste new file

Postby subami » Sat Jan 01, 2005 7:03 pm

thank you very much. it works perfectly!
User avatar
subami
Newbie
 
Posts: 7
Joined: Fri Dec 31, 2004 12:00 am


Return to Macros

cron