How to Loop Action in MultiSelctionLine?

Help with writing and playing macros

How to Loop Action in MultiSelctionLine?

Postby carsonwen » Mon Dec 27, 2004 9:44 pm

Help~~
I encounter a problem.
When I select multiLines in UE, I want to add a String "'//" to start postion of each line I was selcted.

I wonder if the UE macros can do it?

e.g.
AAAAAAAA
BBBBBBBB
CCCCCCC
DDDDDDD

When I Select the middle two lines, my expectant results is
AAAAAAAA
'//BBBBBBBB
'//CCCCCCC
DDDDDDD

Help!!
User avatar
carsonwen
Newbie
 
Posts: 2
Joined: Mon Dec 27, 2004 12:00 am

Re: How to Loop Action in MultiSelctionLine?

Postby Mofi » Tue Dec 28, 2004 3:41 am

If you have syntax highlighting active for this and line comment is defined with '//, simply use Comment Add from menu Edit.

But here is also the macro for that job:

InsertMode
ColumnModeOff
HexOff
UnixReOff
Find RegExp "%^(?^)"
Replace All SelectText "'//^1"
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4058
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: How to Loop Action in MultiSelctionLine?

Postby carsonwen » Tue Dec 28, 2004 8:42 pm

Thank you for help!
Your Macros is well done!

Any way, I have another corresponding problem, I need another macro to remove the comment.
for example:

AAAAAAA
'//BBBBBB
'//CCCCCC include several space
'//'//DDDD'//
EEEEEEEE

when i multiSelect the five lines above, my expectant results is :
AAAAAAA
BBBBBB
CCCCCC include several space
'//DDDD'//
EEEEEEEE

It only remove first comment string for each line!
Please help again, I just a new user!
Thank
User avatar
carsonwen
Newbie
 
Posts: 2
Joined: Mon Dec 27, 2004 12:00 am

Re: How to Loop Action in MultiSelctionLine?

Postby Mofi » Thu Dec 30, 2004 3:16 am

Same method for removing as for adding:

InsertMode
ColumnModeOff
HexOff
UnixReOff
Find RegExp "%'//"
Replace All SelectText ""
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4058
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna


Return to Macros

cron