使用Emeditor转换编码(Shift-JS 到 UTF-8)

只是一次为了转换日文源码到中文源码时想到的.:-)

/////////////////////日语编码2UTF-8.jsee////////////////////////////

var fso = new ActiveXObject("Scripting.FileSystemObject");
var oFolder = fso.GetFolder(prompt( "Folder", ""));
fc = new Enumerator(oFolder.files);
for (; !fc.atEnd(); fc.moveNext())
{
    var filePath = fc.item();
    var oFile = fso.GetFile(filePath);
    // Set property of file to normal
    oFile.Attributes = 0;
    if (oFile.Name.search(/.+\.h/i) == 0 || oFile.Name.search(/.+\.cpp/i) == 0 || oFile.Name.search(/.+\.txt/i) == 0)
    {
        // Open At Japanese (Auto-Select)
        editor.OpenFile(filePath, 50932, eeOpenAllowNewWindow);
        // Save At UTF-8
        editor.ExecuteCommandByID(4255);
        document.close();
    }
}

posted @ 2010-08-24 22:10  dzqabc  阅读(4258)  评论(0编辑  收藏  举报