No, I have not meant to use a macro. I have written about using scripts. The macro environment offers no method to get current column number and add or subtract a fixed value, but the script environment does. Here are the 2 scripts. You have to copy each of them into a separate *.js file:
- Code: Select all
// Script to move the cursor x columns to left - move window left.
UltraEdit.outputWindow.showStatus=false;
if(UltraEdit.document.length > 0) {
var Column = UltraEdit.activeDocument.currentColumnNum;
if (typeof(UltraEdit.activeDocumentIdx) == "undefined") Column++;
if(Column > 100) Column -= 100;
else Column = 1;
UltraEdit.activeDocument.gotoLine(0,Column);
}
// Script to move the cursor x columns to right - move window right.
UltraEdit.outputWindow.showStatus=false;
if(UltraEdit.document.length > 0) {
var Column = UltraEdit.activeDocument.currentColumnNum;
if (typeof(UltraEdit.activeDocumentIdx) == "undefined") Column++;
/* First move the cursor 200 columns to right to force
a complete horizontal scroll of the active window. */
UltraEdit.activeDocument.gotoLine(0,Column + 200);
// Next set the cursor to the really wanted position.
UltraEdit.activeDocument.gotoLine(0,Column + 100);
}
Unfortunately the simple and fast script solution has one big disadvantage - by default when running a script a status message is written into the output window overwritting existing output window content. So maybe 2 macros are really better and I have had also an idea how to code it.
Macro to move the cursor x columns to left - move window left:
Loop 100
IfColNum 1
ExitLoop
Else
Key LEFT ARROW
EndIf
EndLoopI have named above macro "Window Left" which is important because this macro is used also in the second macro.
Macro to move the cursor x columns to right - move window right:
Loop 200
IfCharIs 13
ExitLoop
Else
IfCharIs 10
ExitLoop
Else
Key RIGHT ARROW
EndIf
EndIf
EndLoop
PlayMacro 1 "Window Left"The macro name is case-sensitive!