luminarius, I do not understand why you wrote that
Replace "^c abc" needed to be replaced by
Paste.
^c in a non regular expression or an UltraEdit regular expression find/replace is replaced by current content of active clipboard whereby in an UltraEdit regular expression search/replace string the string in clipboard is also interpreted as regular expression string, i.e. the replacement of
^c by clipboard content is done before search/replace string is evaluated. In Unix or Perl regular expressions
^c as reference for clipboard content is not working because
^c means find character
c at beginning of a line.
The posted macro was written more than 11 years ago for a version of UltraEdit not supporting scripts. Such tasks can be much easier achieved in the meantime with an UltraEdit script because variables, mathematical operations and string manipulating operations can be used in UltraEdit scripts which is not possible in UltraEdit macros.
Code: Select all
if (UltraEdit.document.length > 0) // Is any file opened?
{
// Define environment for this script.
UltraEdit.insertMode();
if (typeof(UltraEdit.columnModeOff) == "function") UltraEdit.columnModeOff();
else if (typeof(UltraEdit.activeDocument.columnModeOff) == "function") UltraEdit.activeDocument.columnModeOff();
// Move caret to top of the active file.
UltraEdit.activeDocument.top();
// Define the parameters for the replaces.
UltraEdit.ueReOn();
UltraEdit.activeDocument.findReplace.mode=0;
UltraEdit.activeDocument.findReplace.matchCase=false;
UltraEdit.activeDocument.findReplace.matchWord=false;
UltraEdit.activeDocument.findReplace.regExp=false;
UltraEdit.activeDocument.findReplace.searchDown=true;
if (typeof(UltraEdit.activeDocument.findReplace.searchInColumn) == "boolean")
{
UltraEdit.activeDocument.findReplace.searchInColumn=false;
}
UltraEdit.activeDocument.findReplace.preserveCase=false;
UltraEdit.activeDocument.findReplace.replaceAll=false;
UltraEdit.activeDocument.findReplace.replaceInAllOpen=false;
// Run a simple, case-insensitive, not regular expression replace
// in a loop from top of file to end of file to insert a number
// starting with value 0 before every abc in the file.
var nNumber = 0;
while(UltraEdit.activeDocument.findReplace.replace("abc",nNumber.toString(10)+" abc")) nNumber++;
}
Hotkeys or chords (multi-key assignment) can be assigned to internal commands of UltraEdit at
Advanced - Settings or Configuration - Key mapping. The name of the command with tooltip
Go to last position (UE < 23.00) or
Go to previous position (UE ≥ 23.00) in the list of commands depends on version of UltraEdit for Windows. It is
SearchGoBack with UE < v23.00 and
Back (last position) with UE ≥ 23.00.