Winny補助ツール総合スレ Part11

このエントリーをはてなブックマークに追加
71/3
Firefox
userChrome.jsを使って、WLR登録する方法

(function() {
var mItem = document.createElement("menuitem");
mItem.setAttribute("label", "WLR\u3067\u767b\u9332");
mItem.setAttribute("accesskey", "w");
mItem.setAttribute("hidden", "true");
mItem.setAttribute("oncommand", "fx2SelWrd();");
var cMenu = document.getElementById("contentAreaContextMenu");
cMenu.insertBefore(mItem, cMenu.firstChild);
cMenu.addEventListener("popupshowing", function() {
if (gContextMenu.isTextSelected) {
var sel = document.commandDispatcher.focusedWindow.getSelection().toString();
} else if (gContextMenu.onTextInput) {
var start = gContextMenu.target.selectionStart, end = gContextMenu.target.selectionEnd;
if (start == end) { mItem.hidden = true; return;}
sel = gContextMenu.target.value.substring(start, end);
} else { mItem.hidden = true; return; }
mItem.hidden = /\b[0-9a-f]{32}?\b/.test(sel) ? false : true;
}, false);
})();
var fx2SelWrd = function () {
var Path = "F:\\Program Files\\WLR_Winny_List_Register"; //WLRのフォルダを指定 適宜変更、\は2つずつ
var exePath = Path + "\\WLR.exe";
var datPath = Path + "\\SelWrd.dat";
var dispatcher = document.commandDispatcher;
var strSelText = (dispatcher.focusedWindow.getSelection().toString() ||
dispatcher.focusedElement.value.substring(dispatcher.focusedElement.selectionStart, dispatcher.focusedElement.selectionEnd));
strSelText = strSelText.replace(/^\s+/, "").replace(/\s+$/, "");
82/3:2008/02/19(火) 01:28:44 ID:0utZbbHc0
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 oStream = Components.classes['@mozilla.org/network/file-output-stream;1'].createInstance(Components.interfaces.nsIFileOutputStream);
oStream.init(localFile, 0x02 | 0x08 | 0x20, 644, 0);
oStream.write(strDoc, strDoc.length);
oStream.close();
var args = ["-2", datPath];
localFile.initWithPath(exePath);
var process = Components.classes["@mozilla.org/process/util;1"].getService(Components.interfaces.nsIProcess);
process.init(localFile);
process.run(false, args, args.length);
} catch(e) {
alert("error:\n" + e);
return false;
}
};
93/3:2008/02/19(火) 01:29:23 ID:0utZbbHc0
userChrome.jsを入れ
>>7-8をコピペ