-- Copyright 1996-2003 Robelle Solutions Technology Inc. -- Version 1.10 May 5, 2003 name QSLUtilStrings group "Ro&belle" command "S&tring functions"; property QSLScriptVersion = "StringFunctions 1.10 - Copyright Robelle Solutions Technology 2003"; on command "&Upshift selection" theFile = qedit.activefile; theText = theFile.getselectedtext(); if length(theText) > 0 and length(theFile.Selection) > 1 then -- simple string. Not caret. Not rectangular. theTextUpshifted = {}; repeat for aLine in theText theTextUpshifted = theTextUpshifted + upshift(aLine); endrepeat if length(theFile.selection) = 2 then -- regular selection theFile.delete(range: theFile.selection); theFile.insert(at: theFile.selection.start, text: theTextUpshifted); else -- rectangular theSelection = {}; theSelection.start = theFile.selection.start; theSelection.end = theFile.selection.end; theFirstLine = theSelection.start.line; theLastLine = theSelection.end.line; replacementLine = 1; repeat for theFirstLine from theFirstLine to theLastLine theSelection.start.line = theFirstLine; theSelection.end.line = theFirstLine; theFile.delete(range: theSelection); theFile.insert(at: theSelection.start, text: theTextUpshifted[replacementLine]); replacementLine = replacementLine + 1; endrepeat endif else result = dialog("You must select some text to upshift!"); endif endon on command "&Downshift selection" theFile = qedit.activefile; theText = theFile.getselectedtext(); if length(theText) > 0 and length(theFile.Selection) > 1 then -- simple string. Not caret. writelog(theText); theTextUpshifted = {}; repeat for aLine in theText theTextUpshifted = theTextUpshifted + downshift(aLine); endrepeat if length(theFile.selection) = 2 then -- regular selection theFile.delete(range: theFile.selection); theFile.insert(at: theFile.selection.start, text: theTextUpshifted); else -- rectangular theSelection = {}; theSelection.start = theFile.selection.start; theSelection.end = theFile.selection.end; theFirstLine = theSelection.start.line; theLastLine = theSelection.end.line; replacementLine = 1; repeat for theFirstLine from theFirstLine to theLastLine theSelection.start.line = theFirstLine; theSelection.end.line = theFirstLine; theFile.delete(range: theSelection); theFile.insert(at: theSelection.start, text: theTextUpshifted[replacementLine]); replacementLine = replacementLine + 1; endrepeat endif else result = dialog("You must select some text to downshift!"); endif endon