Winny補助ツール総合スレ Part8

このエントリーをはてなブックマークに追加
528[名無し]さん(bin+cue).rar
(function() {var mItem = document.createElement("menuitem");
mItem.setAttribute("label", "WLR\u3067\u767b\u9332");
mItem.setAttribute("accesskey", "w");
mItem.addEventListener("command", fx2SelWrd, false);
var cMenu = document.getElementById("contentAreaContextMenu")
cMenu.insertBefore(mItem, cMenu.firstChild);
cMenu.addEventListener("popupshowing", function() {mItem.hidden = !gContextMenu.isTextSelected;}, false);
function fx2SelWrd() {
var WLRPath = "C:\\Program Files\\Winny2\\Tools\\WLR2\\WLR.exe"; //適宜変更、バックスラッシュは2つずつ
var DatPath = "C:\\PROGRA~1\\Winny2\\Tools\\WLR2\\SelWrd.dat"; //下に同じ、但し半角空白禁止
var strSelText = getBrowserSelection();
try { var localFile = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
localFile.initWithPath(DatPath);
var uc = Components.classes['@mozilla.org/intl/scriptableunicodeconverter'].getService(Components.interfaces.nsIScriptableUnicodeConverter);
uc.charset = "SHIFT-JIS";
var strDoc = uc.ConvertFromUnicode(strSelText);
var DatPathS = uc.ConvertFromUnicode(DatPath);
var oStream = Components.classes['@mozilla.org/network/file-output-stream;1'].createInstance(Components.interfaces.nsIFileOutputStream);
oStream.init(localFile, 0x02 | 0x08 | 0x20, 644, 0);
var result = oStream.write(strDoc, strDoc.length);
oStream.close();} catch(e) {alert("error:\n" + e);return false;}
var args = ["-2", DatPathS];
var wlr = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
wlr.initWithPath(WLRPath);
var process = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
process.init(wlr);
process.run(false, args, args.length);}})();