name stars; -- replace a rectangle of stars Property CurrentFile = 0; -- shared global variable Property CurrentSel = 0; sub CheckFileOpen flag = false; file = qedit.activefile; -- we need an object to insert into if typeof(file)=qedit.typeundefined result=dialog("You must have a file open"); else CurrentFile = file; -- update shared Global variable flag = true; endif return flag; endsub sub CheckSelection flag = false; if CheckFileOpen() s = CurrentFile.selection; if length(s) = 1 then -- Oops, only a caret is active r = dialog("You must have an active selection to fill."); else CurrentSel = s; flag = true; endif endif return flag; endsub if CheckSelection() then startsel = CurrentSel.start; startl = startsel.line; startc = startsel.column; endsel = CurrentSel.end; -- unknown property if no selection endl = endsel.line; endc = endsel.column; if length(CurrentSel) = 2 then --- oops, not rectangular r = dialog("STARS only works on rectangles. Use Control-Drag."); stop; endif CurrentFile.delete(); -- delete current selection width= endc - startc + 1; stars = ""; repeat for x from 1 to width by 1 stars = stars + "*"; endrepeat -- insert a new rectangle of same size, consisting of stars r=CurrentFile.insertcolumn(startline: startl, endline: endl, atcolumn: startc, text: stars); -- Cancel selection, Position caret at upper left corner: CurrentFile.select(startline: startl, startcolumn: startc); endif << Author: bgreen@robelle.com Date: Sept 14, 1999 Web: replace01.qsl Comments: 1. You will run this script from the Script Menu. 2. Save insert05 as a local file, stars.qsl anywhere on c:\ drive. 3. Go to Script-ManageScripts dialog. 4. If 'stars' is already there, click and Remove it. 5. Click Add and browse to stars.qsl file and select it. 6. Click Done to finish ManageScripts dialog. 7. Open any file with some text in it. 8. Create a rectangular selection using Control and mouse-drag. 9. Select Script-Stars to replace the selection with stars. 10. This script is based on insert05.qsl -- see it for coding notes. 10. The Delete() call means to delete the current selection, then we do an Insertcolumn() call. There is currently no replace() method. >>