Welcome to the IDM Forum. This forum is meant as a user-to-user support mechanism where users can share knowledge and tips for all IDM software.
Since these forums are user-to-user based, IDM does not regularly read or reply to the posts in this forum. For problem reports, suggestions, or feature requests, you must email us directly. Our trained technical support staff answers most inquiries within 30 minutes.

"ファイル";"File"
"レイヤー";"Layer"
"ペン";"Airbrush"
"フォルダー";"Folder"function utf16to8(str) {
/* Copyright (C) 1999 Masanao Izumo <iz@onicos.co.jp>
* Version: 1.0
* LastModified: Dec 25 1999
* This library is free. You can redistribute it and/or modify it.
* http://www.onicos.com/staff/iz/amuse/javascript/expert/utf.txt */
var out, i, len, c;
out = "";
len = str.length;
for(i = 0; i < len; i++) {
c = str.charCodeAt(i);
if ((c >= 0x0001) && (c <= 0x007F)) {
out += str.charAt(i);
} else if (c > 0x07FF) {
out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
} else {
out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
}
}
return out;
}
if (UltraEdit.document.length > 1) // At least 2 files opened in UltraEdit?
{
// Define environment for script.
UltraEdit.ueReOn(); // Use UltraEdit regular expression search engine.
UltraEdit.insertMode(); // Turn on insert mode.
UltraEdit.columnModeOff(); // Turn off column mode.
// Determine which file to edit and which file contains the strings by
// finding out which file is opened in hex edit mode: first or second file.
var FileToEdit = UltraEdit.document[0];
var FileWithStrings = UltraEdit.document[1];
if (UltraEdit.document[0].hexMode == false)
{
FileToEdit = UltraEdit.document[1];
FileWithStrings = UltraEdit.document[0];
}
FileWithStrings.selectAll(); // Select entire content of active file.
UltraEdit.selectClipboard(9); // Copy selection to user clipboard 9 as selection property
FileWithStrings.copy(); // of UltraEdit document does not support Unicode strings.
// Get just the strings in double quotes and the DOS line terminators into a large Unicode
// string whereby every semicolon in the CSV file is replaced by a DOS line termination too.
var sUnicodeStrings = UltraEdit.clipboardContent.replace(/\"(.+?)\";\"(.+?)\"/g,"$1\r\n$2");
// Clear user clipboard 9 and cancel selection by moving caret to top of input file.
UltraEdit.clearClipboard();
UltraEdit.selectClipboard(0);
FileWithStrings.top();
// Split this large Unicode string into an array of Unicode strings on every DOS line termination.
var asSearchReplace = sUnicodeStrings.split("\r\n");
// Remove the last string if it is an empty string because file ended with a line termination.
if (asSearchReplace[asSearchReplace.length-1] == "") asSearchReplace.pop();
// The array of Unicode strings contains search and replace strings which should be encoded in
// UTF-8 and the encoded characters converted to ASCII strings with the hexadecimal numbers of
// the UTF-8 characters. Define arrays to hold in memory those search and replace strings.
var asHexSearchStrings = new Array();
var asHexReplaceStrings = new Array();
// In the following loop all search/replace Unicode strings are converted to ASCII strings with the
// hexadecimal values of the UTF-8 encoded strings. The space between the hexadecimal values is not
// really neded for the replaces and therefore omitted for faster script execution and less memory
// usage.
for (var nStringIndex = 0; nStringIndex < asSearchReplace.length; nStringIndex++)
{
// Convert next search string from UTF-16 LE to UTF-8 with converting first \n in string to 0D 0A.
var sUtf8Search = utf16to8(asSearchReplace[nStringIndex++].replace(/\\n/g,"\r\n"));
// Convert next replace string from UTF-16 LE to UTF-8 with converting first \n in string to 0D 0A.
var sUtf8Replace = utf16to8(asSearchReplace[nStringIndex].replace(/\\n/g,"\r\n"));
// If UTF-8 encoded replace string is longer than UTF-8 encoded search string, ignore those strings.
if (sUtf8Replace.length > sUtf8Search.length) continue;
// Convert number of UTF-8 characters in search string to ASCII string with hexadecimal value.
var sStringLength = sUtf8Search.length.toString(16);
// If the length of this string is odd, an additional leading zero is needed.
var sNextSearch = (sStringLength.length % 2) ? "0" : "";
sNextSearch += sStringLength;
// Convert the UTF-8 search string to ASCII string with hexadecimal values of the bytes.
for (var nByteIndex = 0; nByteIndex < sUtf8Search.length; nByteIndex++)
{
var nCharValue = sUtf8Search.charCodeAt(nByteIndex);
if (nCharValue < 16) sNextSearch += "0";
sNextSearch += nCharValue.toString(16);
}
// The same as above must be done also for the replace string.
sStringLength = sUtf8Replace.length.toString(16);
var sNextReplace = (sStringLength.length % 2) ? "0" : "";
sNextReplace += sStringLength;
for (nByteIndex = 0; nByteIndex < sUtf8Replace.length; nByteIndex++)
{
nCharValue = sUtf8Replace.charCodeAt(nByteIndex);
if (nCharValue < 16) sNextReplace += "0";
sNextReplace += nCharValue.toString(16);
}
// Append '0' to replace string if shorter than search string.
for (nByteIndex = sNextReplace.length; nByteIndex < sNextSearch.length; nByteIndex++)
{
sNextReplace += "0";
}
asHexSearchStrings.push(sNextSearch.toUpperCase());
asHexReplaceStrings.push(sNextReplace.toUpperCase());
}
// Make the replaces in hex edit mode on file to edit using the strings from the other file.
FileToEdit.top();
FileToEdit.findReplace.mode=0;
FileToEdit.findReplace.searchAscii=false;
FileToEdit.findReplace.matchCase=false;
FileToEdit.findReplace.regExp=false;
FileToEdit.findReplace.searchDown=true;
FileToEdit.findReplace.replaceAll=false;
for (nStringIndex = 0; nStringIndex < asHexSearchStrings.length; nStringIndex++)
{
FileToEdit.findReplace.replace(asHexSearchStrings[nStringIndex],asHexReplaceStrings[nStringIndex]);
}
}
Find "いくつかの例
とテキスト
改行"
Replace "Some example
text with a
line break""いくつかの例\nとテキスト\n改行";"Some example\ntext with a\nline break"Find "これが収まる"
Replace "This will fit"
Find "これは適合しません"
Replace "This will not fit because the string is too long" // Convert next search string from UTF-16 LE to UTF-8.
var sUtf8Search = utf16to8(asSearchReplace[nStringIndex++]);
// Convert next replace string from UTF-16 LE to UTF-8.
var sUtf8Replace = utf16to8(asSearchReplace[nStringIndex]); // Convert next search string from UTF-16 LE to UTF-8 with converting first \n in string to 0D 0A.
var sUtf8Search = utf16to8(asSearchReplace[nStringIndex++].replace(/\\n/g,"\r\n"));
// Convert next replace string from UTF-16 LE to UTF-8 with converting first \n in string to 0D 0A.
var sUtf8Replace = utf16to8(asSearchReplace[nStringIndex].replace(/\\n/g,"\r\n"));
function utf16to8(str) {
/* Copyright (C) 1999 Masanao Izumo <iz@onicos.co.jp>
* Version: 1.0
* LastModified: Dec 25 1999
* This library is free. You can redistribute it and/or modify it.
* http://www.onicos.com/staff/iz/amuse/javascript/expert/utf.txt */
var out, i, len, c;
out = "";
len = str.length;
for(i = 0; i < len; i++) {
c = str.charCodeAt(i);
if ((c >= 0x0001) && (c <= 0x007F)) {
out += str.charAt(i);
} else if (c > 0x07FF) {
out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
} else {
out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
}
}
return out;
}
if (UltraEdit.document.length > 0) // At least 1 file opened in UltraEdit?
{
// Define environment for script.
UltraEdit.ueReOn(); // Use UltraEdit search engine.
UltraEdit.insertMode(); // Turn on insert mode.
UltraEdit.columnModeOff(); // Turn off column mode.
// Get document index number of active file.
var nCsvFileIndex = UltraEdit.activeDocumentIdx;
// Has the active file the file extension JS?
if (UltraEdit.activeDocument.isExt("js"))
{
// Yes, the active file is most likely this script file.
// The CSV file is therefore either the first file if this
// is not the active file, or otherwise the second file.
nCsvFileIndex = !nCsvFileIndex ? 1 : 0;
}
var CsvFile = UltraEdit.document[nCsvFileIndex];
CsvFile.selectAll(); // Select entire content of active file.
UltraEdit.selectClipboard(9); // Copy selection to user clipboard 9 as selection property
CsvFile.copy(); // of UltraEdit document does not support Unicode strings.
// Get just the strings in double quotes and the DOS line terminators into a large Unicode
// string whereby every semicolon in the CSV file is replaced by a DOS line termination too.
var sUnicodeStrings = UltraEdit.clipboardContent.replace(/\"(.+?)\";\"(.+?)\"/g,"$1\r\n$2");
// Clear user clipboard 9 and cancel selection by moving caret to top of input file.
UltraEdit.clearClipboard();
CsvFile.top();
// Split this large Unicode string into an array of Unicode strings on every DOS line termination.
var asSearchReplace = sUnicodeStrings.split("\r\n");
// Remove the last string if it is an empty string because file ended with a line termination.
if (asSearchReplace[asSearchReplace.length-1] == "") asSearchReplace.pop();
// The array of Unicode strings contains search and replace strings which should be encoded in
// UTF-8 and the encoded characters converted to ASCII strings with the hexadecimal numbers of
// the UTF-8 characters. Define arrays to hold in memory those search and replace strings.
var asHexSearchStrings = new Array();
var asHexReplaceStrings = new Array();
var anIgnoredStrings = new Array();
// In the following loop all search/replace Unicode strings are converted to ASCII strings with the
// hexadecimal values of the UTF-8 encoded strings. The space between the hexadecimal values is not
// really neded for the replaces and therefore omitted for faster script execution and less memory
// usage.
for (var nStringIndex = 0; nStringIndex < asSearchReplace.length; nStringIndex++)
{
// Convert next search string from UTF-16 LE to UTF-8 with converting first \n in string to 0D 0A.
var sUtf8Search = utf16to8(asSearchReplace[nStringIndex++].replace(/\\n/g,"\r\n"));
// Convert next replace string from UTF-16 LE to UTF-8 with converting first \n in string to 0D 0A.
var sUtf8Replace = utf16to8(asSearchReplace[nStringIndex].replace(/\\n/g,"\r\n"));
// If UTF-8 encoded replace string is longer than UTF-8 encoded search string, ignore those strings.
if (sUtf8Replace.length > sUtf8Search.length)
{
// Remember line number with the strings ignored.
anIgnoredStrings.push((nStringIndex+1)/2);
continue;
}
// Convert number of UTF-8 characters in search string to ASCII string with hexadecimal value.
var sStringLength = sUtf8Search.length.toString(16);
// If the length of this string is odd, an additional leading zero is needed.
var sNextSearch = (sStringLength.length % 2) ? "0" : "";
sNextSearch += sStringLength;
// Convert the UTF-8 search string to ASCII string with hexadecimal values of the bytes.
for (var nByteIndex = 0; nByteIndex < sUtf8Search.length; nByteIndex++)
{
var nCharValue = sUtf8Search.charCodeAt(nByteIndex);
if (nCharValue < 16) sNextSearch += "0";
sNextSearch += nCharValue.toString(16);
}
// The same as above must be done also for the replace string.
sStringLength = sUtf8Replace.length.toString(16);
var sNextReplace = (sStringLength.length % 2) ? "0" : "";
sNextReplace += sStringLength;
for (nByteIndex = 0; nByteIndex < sUtf8Replace.length; nByteIndex++)
{
nCharValue = sUtf8Replace.charCodeAt(nByteIndex);
if (nCharValue < 16) sNextReplace += "0";
sNextReplace += nCharValue.toString(16);
}
// Append '0' to replace string if shorter than search string.
for (nByteIndex = sNextReplace.length; nByteIndex < sNextSearch.length; nByteIndex++)
{
sNextReplace += "0";
}
asHexSearchStrings.push(sNextSearch.toUpperCase());
asHexReplaceStrings.push(sNextReplace.toUpperCase());
}
// Create report for the strings ignored because of length condition.
if (anIgnoredStrings.length == 0)
{
UltraEdit.newFile();
UltraEdit.activeDocument.write("No strings ignored because of right string longer than left string.");
}
else
{
var_dump(anIgnoredStrings);
UltraEdit.newFile();
UltraEdit.activeDocument.unixMacToDos();
UltraEdit.activeDocument.ASCIIToUnicode();
UltraEdit.activeDocument.write("Following strings ignored because of right string longer than left string:\r\n\r\n");
for (nStringIndex = 0; nStringIndex < anIgnoredStrings.length; nStringIndex++)
{
CsvFile.gotoLine(anIgnoredStrings[nStringIndex],1);
CsvFile.selectLine();
CsvFile.copyAppend();
}
CsvFile.top();
UltraEdit.activeDocument.paste();
UltraEdit.clearClipboard();
}
UltraEdit.activeDocument.top();
// Create output file with the UTF-8 encoded strings in hexadecimal notation.
for (nStringIndex = 0; nStringIndex < asHexSearchStrings.length; nStringIndex++)
{
UltraEdit.clipboardContent += "F: ";
UltraEdit.clipboardContent += asHexSearchStrings[nStringIndex];
UltraEdit.clipboardContent += "\r\nR: ";
UltraEdit.clipboardContent += asHexReplaceStrings[nStringIndex];
UltraEdit.clipboardContent += "\r\n";
}
UltraEdit.newFile();
UltraEdit.activeDocument.unixMacToDos();
UltraEdit.activeDocument.unicodeToASCII();
UltraEdit.activeDocument.paste();
UltraEdit.clearClipboard();
UltraEdit.selectClipboard(0);
}if (UltraEdit.document.length > 1) // At least 2 files opened in UltraEdit?
{
// Define environment for script.
UltraEdit.ueReOn(); // Use UltraEdit search engine.
UltraEdit.insertMode(); // Turn on insert mode.
UltraEdit.columnModeOff(); // Turn off column mode.
// Determine which file to edit and which file contains the strings by
// finding out which file is opened in hex edit mode: first or second file.
var FileToEdit = UltraEdit.document[0];
var FileWithStrings = UltraEdit.document[1];
if (UltraEdit.document[0].hexMode == false)
{
FileToEdit = UltraEdit.document[1];
FileWithStrings = UltraEdit.document[0];
}
FileWithStrings.selectAll(); // Select entire content of active file.
// Get just the hexadecimal values the DOS line terminators into a large ASCII string.
var sAllStrings = FileWithStrings.selection.replace(/F: (.+?)\r\nR: (.+?)/g,"$1\r\n$2");
FileWithStrings.top(); // Cancel selection by moving caret to top of file.
// Split the large string into an array of string which one string per line.
var asSearchReplaceStrings = sAllStrings.split("\r\n");
asSearchReplaceStrings.pop(); // Remove empty string from end of array.
// Make the replaces in hex edit mode on file to edit using the strings from the other file.
FileToEdit.top();
FileToEdit.findReplace.mode=0;
FileToEdit.findReplace.searchAscii=false;
FileToEdit.findReplace.matchCase=false;
FileToEdit.findReplace.regExp=false;
FileToEdit.findReplace.searchDown=true;
FileToEdit.findReplace.replaceAll=false;
for (nStringIndex = 0; nStringIndex < asSearchReplaceStrings.length; nStringIndex++)
{
FileToEdit.findReplace.replace(asSearchReplaceStrings[nStringIndex],asSearchReplaceStrings[++nStringIndex]);
}
}