Macro to REM out every line in a marked block?

6 views
Skip to first unread message

Clueless in Seattle

unread,
Apr 10, 2013, 2:01:05 PM4/10/13
to SemWare TSE Pro text editor
One of my favorite pastimes is lying in bed with my laptop and writing
batch files.

It's sort of like a poor man's video game.

Sometimes I run into a situation in which I need to disable multiple
lines of batch code.

If I mark all those lines as a block with TSE 2.5 for DOS, then I
figure I could write a simple macro that would automatically insert
"REM [space]" at the beginning of each line within that block.

Before I try to figure out how I could do that, I thought I would
first check to see if anyone has already written such a macro, or a
similar one that I could modify.

Will in Seattle
a.k.a "Clueless"
Running TSE 2.5 for DOS
Under MS-DOS 6.21

Campbell, Shaun

unread,
Apr 10, 2013, 2:46:06 PM4/10/13
to sem...@googlegroups.com
I have a macro that does the same kind of thing but for COBOL. It runs down a block and puts a * in column 7. It could easily be modified to do what you want. Just change the last two lines to go to column 1 and insert "REM ".

Comment.s

forward proc add_comm()

proc main()
integer curspos = 0
// For development only
// Set(Break, ON)
OneWindow()
if isBlockMarked() == _line_
GotoBlockBegin()
repeat
add_comm()
until not down() or not IsCursorInBlock()
GotoBlockBegin()
else
curspos = CurrCol()
add_comm()
GotoColumn(curspos)
endif
end

/* Procedures */

proc add_comm()
GotoColumn(7)
InsertText("*",_insert_)
end
--

---
You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Shaun Campbell
Implementation Programmer
P: 800.772.2260 ext. 4119

Fred H Olson

unread,
Apr 10, 2013, 3:21:23 PM4/10/13
to SemWare TSE Pro text editor
On Wed, 10 Apr 2013, Clueless in Seattle wrote:

> Sometimes I run into a situation in which I need to disable multiple
> lines of batch code.
>
> If I mark all those lines as a block with TSE 2.5 for DOS, then I
> figure I could write a simple macro that would automatically insert
> "REM [space]" at the beginning of each line within that block.

Why not use a simple replace? After marking the block.
replace: ^ with: REM<sp> with options: lxn

^ is the regular expression char that finds the beginning of the line
l restricts it to the marked block
x treats the seach as a regular expression
n does all replacements without asking

Fred

--
Fred H. Olson Minneapolis,MN 55411 USA (near north Mpls)
Email: fholson at cohousing.org 612-588-9532
My Link Pg: http://fholson.cohousing.org My org:
Communications for Justice -- Free, superior listserv's w/o ads

Dan Ginzel

unread,
Apr 10, 2013, 3:49:05 PM4/10/13
to sem...@googlegroups.com
I would add the "B" option. Without it, the cursor would have to be on or before the first line of the block.

Robert Seely

unread,
Apr 10, 2013, 4:00:34 PM4/10/13
to SemWare TSE Pro text editor

I use the quote.s macro - I even modified it to include tex files
(putting a % at the start of lines, etc) - but I think bat files are
included in the original version. Certainly it puts REM at the start
of any lines it's hit with. If you highlight a block, it'll rem
every line in the block at once. It is smart enough to use the
appropriate remark convention for the filetype being edited.

-= rags =-

> On Wed, 10 Apr 2013, Clueless in Seattle wrote:
>
>> Sometimes I run into a situation in which I need to disable multiple
>> lines of batch code.
>>
>> If I mark all those lines as a block with TSE 2.5 for DOS, then I
>> figure I could write a simple macro that would automatically insert
>> "REM [space]" at the beginning of each line within that block.


--
<ra...@math.mcgill.ca>
<www.math.mcgill.ca/rags>

Fred H Olson

unread,
Apr 10, 2013, 4:05:54 PM4/10/13
to sem...@googlegroups.com
On Wed, 10 Apr 2013, Dan Ginzel wrote:

> I would add the "B" option. Without it, the cursor would have to be
> on or before the first line of the block.

Good point but the added option seems to be "g" to
start the search at the beginning of the file (block).
Option "b" serches backward.

BTW while checking this I noticed that an option (rather than
regular expression in the search target field is:

^ - limit the search to the beginning of the line.

except you can not search for nothing at the beginning of the line
so it is relevant in this case.

Fred
Reply all
Reply to author
Forward
0 new messages