name PasteInBox; -- insert paste into size of rect selection 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("PasteInBox only works on rectangles. Use Control-Drag."); stop; endif --r=dialog(string(CurrentSel)); width= endc - startc + 1; -- insert some spaces to replace spaces = ""; repeat for x from 1 to width by 1 spaces = spaces + " "; endrepeat --r=dialog("width="+string(width)+spaces); -- insert a new rectangle of same size, consisting of spaces CurrentFile.insertcolumn(startline: startl, endline: endl, atcolumn: startc, text: spaces); --r=dialog("after insertcolumn-did selection screw it up?"); -- rectangle should still be selected, so now paste-replace CurrentFile.Paste(); -- Cancel selection, Position caret at upper left corner: CurrentFile.select(startline: startl, startcolumn: startc); endif << Author: bgreen@robelle.com Date: Sept 15, 1999 Web: pasteinbox.qsl Comments: 1. You will run this script from the Script Menu. 2. Save insert05 as a local file, pasteinbox.qsl anywhere on c:\ drive. 3. Go to Script-ManageScripts dialog. 4. If 'PasteInBox' is already there, click and Remove it. 5. Click Add and browse to pasteinbox.qsl file and select it. 6. Click Done to finish ManageScripts dialog. 7. Open any file with some text in it. 8. Highlight a rectangle using Control and mouse-drag, then Copy it into the clipboard. 8. Select a different rectangular area using Control and mouse-drag. 9. Select Script-PasteInBox to insert the clipboard into a space that size. 10. This script is based on replace01.qsl -- see it for coding notes. 11. Paste with a rectangular selection currently only does a Replace, not an Insert. This script provides that missing functionality. >>