How to prefix each line in a selected block of code?

Help with writing and playing macros

How to prefix each line in a selected block of code?

Postby jiminalaska » Fri Aug 04, 2006 9:38 pm

Is it possible to prefix each source line with a given character in a selected block of code?
--

The SQR programming language uses the exclamation mark (!) as a comment indicator. All characters to the right of the exclamation mark to the end-of-line are treated as comments.

Unfortunately, SQR does not have a multiple line block comment construct like the classic /* */ convention of many other languages.

I would like to be able to select a multiple line block of code (via click+dragging the mouse) and then run a macro which would insert an exclamation mark at the beginning of each line.

If anyone knows how to do this, would they please explain how this can be done? (I can easily record a macro which will insert an exclamation mark, move down one row, and move back one character, positioning itself for another iteration of the same macro, but I don't know how to automatically do this for multiple rows within a selected block.)

Thanks,
Jim in Alaska
User avatar
jiminalaska
Newbie
 
Posts: 2
Joined: Thu Aug 03, 2006 11:00 pm

Re: How to prefix each line in a selected block of code?

Postby PaoloFCantoni » Sat Aug 05, 2006 6:11 am

Define a WordFile for the SQR language

Define the comment character

Edit|Add Comment and Edit|Remove Comment will do the rest...

The Wordfile can be pretty minimal...

HTH,
Paolo
User avatar
PaoloFCantoni
Power User
Power User
 
Posts: 113
Joined: Sun May 01, 2005 11:00 pm
Location: Perth, Western Australia

Re: How to prefix each line in a selected block of code?

Postby Mofi » Sat Aug 05, 2006 12:32 pm

Look at this website in the download area at Downloads - Additional Downloads - Wordfiles. There you will find PeopleSoft SQR, a syntax highlighting wordfile for SQR. Add the content of the file to your wordfile as described at the download page. The usage is explained already by Paolo.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4066
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: How to prefix each line in a selected block of code?

Postby denoit » Tue Aug 08, 2006 3:35 pm

Select the block of code -
Toggle COLUMN MODE = ON -
Type exclamation mark.
User avatar
denoit
Newbie
 
Posts: 1
Joined: Mon Aug 07, 2006 11:00 pm


Return to Macros