I wonder if there is a program that I can use with a list of terms I want to replace instead of take one by one.
Example
À=À
â=â
Â=Â
å=å
Å=Å
ã=ã
Ã=Ã
Thank you in advance
I use UltraEdit and powergrep atm.
UltraEdit has 2 features for automating reformatting tasks: macros and scripts.
See UltraEdit forum topic When to use Scripts over Macros for a brief overview of the differences.
An UltraEdit macro can be created by simply recording the replaces you manually do once on a file or you code them directly in Edit/Create Macro dialog.
A manual creation is done as follows:
ReplaceEntities
.InsertMode
ColumnModeOff
HexOff
The macro is then ready for usage
Also Macro - Play Again can be very often used depending on which macro was last time executed.
The macro code required additionally to 3 standard commands already present in the dialog to replace in entire active file HTML entities is for example:
Top
UltraEditReOn
Find MatchCase "À"
Replace All "À"
Find MatchCase "â"
Replace All "â"
Find MatchCase "Â"
Replace All "Â"
Find MatchCase "å"
Replace All "å"
Find MatchCase "Å"
Replace All "Å"
Find MatchCase "ã"
Replace All "ã"
Find MatchCase "Ã"
Replace All "Ã"
It is necessary to save this UE macro (without or with other UE macros) into a macro file by using Macro - Save All.
For using this macro (and other macros store in same macro file) later again, it is necessary to load the macro file using Macro - Load.
With Macro - Set Auto Load it is possible to select a macro file for being automatically loaded on startup of UltraEdit so that the macros in this macro file are available from beginning without an explicit loading of the macro file.
The macro properties can be also changed later by using Macro - Delete Macro/Modify Properties. Don't forget to use Macro - Save All after making a change to a macro code or its properties to save this change in macro file, too.
UltraEdit scripts make use of the JavaScript core engine. An UltraEdit script is an ASCII/ANSI text file containing JavaScript core code with additional UltraEdit related scripting commands. This means an UltraEdit script can be written directly like any other text file and must not be edited in a dialog.
An UltraEdit script which makes exactly the same as the macro above would be:
if (UltraEdit.document.length > 0) // Is any file opened?
{
// Define environment for this script.
UltraEdit.insertMode();
UltraEdit.columnModeOff();
UltraEdit.activeDocument.hexOff();
// Move caret to top of the active file.
UltraEdit.activeDocument.top();
// Define all parameters for several Replace All in entire active file.
UltraEdit.ueReOn();
UltraEdit.activeDocument.findReplace.mode=0;
UltraEdit.activeDocument.findReplace.matchCase=true;
UltraEdit.activeDocument.findReplace.matchWord=false;
UltraEdit.activeDocument.findReplace.regExp=false;
UltraEdit.activeDocument.findReplace.searchDown=true;
UltraEdit.activeDocument.findReplace.preserveCase=false;
UltraEdit.activeDocument.findReplace.replaceAll=true;
UltraEdit.activeDocument.findReplace.replaceInAllOpen=false;
UltraEdit.activeDocument.findReplace.selectText=false;
// This property is only available since UE v14.10.
if (typeof(UltraEdit.activeDocument.findReplace.searchInColumn) == "boolean")
{
UltraEdit.activeDocument.findReplace.searchInColumn=false;
}
UltraEdit.activeDocument.findReplace.replace("À","À");
UltraEdit.activeDocument.findReplace.replace("â","â");
UltraEdit.activeDocument.findReplace.replace("Â","Â");
UltraEdit.activeDocument.findReplace.replace("å","å");
UltraEdit.activeDocument.findReplace.replace("Å","Å");
UltraEdit.activeDocument.findReplace.replace("ã","ã");
UltraEdit.activeDocument.findReplace.replace("Ã","Ã");
}
Such an UltraEdit script should be saved with file extension .js, for example ReplaceEntities.js
.
Once an UE script is saved, it can added via Scripting - Scripts to the Script List with adding a short description for the script and assigning a hotkey/chord to the script for quick execution by key.
The script is then ready for usage
If an UE script is the active file AND it is written to run NOT on active document, the script can be also executed with Scripting - Run Active Script. But most scripts like the one above are written to run on active file and therefore requires adding the script file to the script list for execution.
The core objects and functions of JavaScript are not documented anywhere within UltraEdit although they can be also used in UltraEdit scripts. The documentation for the core features can be found on Mozilla Developer site.
The additional scripting commands of UltraEdit are documented in help of UE on page with title Scripting commands. There is additionally View - Views/Lists - Tag List containing the tag groups UE/UES Script Commands and also UE/UES Macro Commands for quick adding a scripting or macro command of UE in active file at current position of the caret.