脚本写的IE右键助手
下载地址:脚本文件
//原作者:张三疯
//功能改进:海娃(51windows)
//http://www.51windows.Net
//设置文本保存的默认目录,注意:程序不能创建二级目录
var fdir="D:\\\\MyCode";
var fsdir=fdir.replace(/\\\\/g,"\\");
var fdrive = fdir.substring(0,1);
var fsubdir = fdir.substring(4,fdir.length);
//以下内容不需更改
var fso, d, fl, fn, fo,foo,fs,fss,windir, WSHShell,fw,fww;
fso = new ActiveXObject("Scripting.FileSystemObject");
d = fso.GetDrive(fdrive);
WSHShell = WScript.CreateObject("WScript.Shell");
var errorChar=/(\/|:|\*|\?|"|\|\|)/;
//如果没有指定的驱动器,或者驱动器类型不是硬盘,或者目录名包含非法字符.则弹出错误信息
if (!fso.DriveExists(fdrive) || d.DriveType!=2 || errorChar.test(fsubdir))
{WSHShell.Popup("文本保存目录错误,请重新设置文本保存目录.");}
else
{
if (!fso.FolderExists(fsdir))
{fso.CreateFolder(fsdir);}
windir=fso.GetSpecialFolder(0);
fn=windir+"\\savetext.htm";
fl = fso.CreateTextFile(fn,true);
fl.WriteLine('');
fl.WriteLine('//原作者:张三疯');
fl.WriteLine('//功能改进:海娃(51windows)');
fl.WriteLine('//http://www.51windows.Net');
fl.WriteLine('var oWindow = window.external.menuArguments;');
fl.WriteLine('var oDocument = oWindow.document;');
fl.WriteLine('var oSelect = oDocument.selection;');
fl.WriteLine('var oSelectRange = oSelect.createRange();');
fl.WriteLine('var selectText = oSelectRange.text;');
fl.WriteLine('var tFilename;');
fl.WriteLine('var parentwin = external.menuArguments;');
fl.WriteLine('var doc = parentwin.document;');
fl.WriteLine('var url = doc.URL;');
fl.WriteLine('if(selectText.length == 0)');
fl.WriteLine('{');
fl.WriteLine(' alert("请先选择一段要保存的文字!");');
fl.WriteLine('}');
fl.WriteLine('else');
fl.WriteLine('{');
fl.WriteLine(' tFilename = (selectText.substring(0,20) + "_" + selectText.substring(selectText.length-6,selectText.length)).replace(/([\\*\\?\\|\\\\\\/\\|\\t\\n\\r\\t\\f":])/g,"");');
fl.WriteLine(' tFilename = prompt("你可以手工输入文件名(不要包含"\\/:*?")\\n(加扩展名).",tFilename+".txt");');
fl.WriteLine(' if(tFilename!=null)');
fl.WriteLine(' {');
fl.WriteLine(' tFilename = tFilename.replace(/([\\*\\?\\|\\\\\\/\\|\\t\\n\\r\\t\\f":])/g,"");');
fl.WriteLine(' var fso, fl, fname;');
fl.WriteLine(' fso = new ActiveXObject("Scripting.FileSystemObject");');
fl.WriteLine(' fname="D:\\\\MyCode\\\\" +tFilename;');
fl.WriteLine(' if (fso.FileExists(fname))');
fl.WriteLine(' {');
fl.WriteLine(' if (confirm(fname + "\\n\\n已经存在,要替换它吗?"))');
fl.WriteLine(' {');
fl.WriteLine(' fl = fso.CreateTextFile(fname,true);');
fl.WriteLine(' fl.Write("");');
fl.WriteLine(' fl.Write("\\r\\n\\r\\n");');
fl.WriteLine(' fl.Write(selectText);');
fl.WriteLine(' fl.Close();');
fl.WriteLine(' alert(tFilename+" \\n\\n保存成功!");');
fl.WriteLine(' }');
fl.WriteLine(' }');
fl.WriteLine(' else');
fl.WriteLine(' {');
fl.WriteLine(' fl = fso.CreateTextFile(fname,true);');
fl.WriteLine(' fl.Write("");');
fl.WriteLine(' fl.Write("\\r\\n\\r\\n");');
fl.WriteLine(' fl.Write(selectText);');
fl.WriteLine(' fl.Close();');
fl.WriteLine(' alert(tFilename+" \\n\\n保存成功!");');
fl.WriteLine(' }');
fl.WriteLine(' }');
fl.WriteLine(' else');
fl.WriteLine(' {');
fl.WriteLine(' alert("操作取消")');
fl.WriteLine(' }');
fl.WriteLine('}');
fl.WriteLine('');
fl.Close();
fo= windir+"\\openfolder.htm";
foo = fso.CreateTextFile(fo,true);
foo.WriteLine('');
foo.WriteLine('var path="'+fdir+'";');
foo.WriteLine('window.open(path,"","")');
foo.WriteLine('');
foo.Close();
fw= windir+"\\51windows.htm";
fww = fso.CreateTextFile(fw,true);
fww.WriteLine('');
fww.WriteLine('window.open("http://www.51windows.Net","51windows","")');
fww.WriteLine('');
fww.Close();
var fb,fbb;
fb= windir+"\\blueidea.htm";
fbb = fso.CreateTextFile(fb,true);
fbb.WriteLine('');
fbb.WriteLine('window.open("http://www.blueidea.com/bbs","blueidea","")');
fbb.WriteLine('');
fbb.Close();
var fc,fbc;
fc= windir+"\\csdn.htm";
fcc = fso.CreateTextFile(fc,true);
fcc.WriteLine('');
fcc.WriteLine('window.open("http://expert.csdn.net","csdn","")');
fcc.WriteLine('');
fcc.Close();
fs=windir+"\\google.htm";
fss = fso.CreateTextFile(fs,true);
fss.WriteLine('');
fss.WriteLine('var oWindow = window.external.menuArguments;');
fss.WriteLine('var oDocument = oWindow.document;');
fss.WriteLine('var oSelect = oDocument.selection;');
fss.WriteLine('var oSelectRange = oSelect.createRange();');
fss.WriteLine('var selectText = oSelectRange.text;');
fss.WriteLine('var tFilename;');
fss.WriteLine('var parentwin = external.menuArguments;')
fss.WriteLine('var doc = parentwin.document;')
fss.WriteLine('var url = doc.URL;')
fss.WriteLine('q =url;')
fss.WriteLine('if (selectText.length == 0){');
fss.WriteLine(' alert("请先选择一段要搜索的文字!");}');
fss.WriteLine('else {');
fss.WriteLine('tFilename = selectText.substring(0,100);');
fss.WriteLine('var str = tFilename.replace(/\]\*>/g," ");');
fss.WriteLine('str = str.replace(/\\s\+/g, " ");');
fss.WriteLine('str = str.replace(/^\\s\*/,"");');
fss.WriteLine('str = str.replace(/\\s\*\$/,"");');
fss.WriteLine('if (str.indexOf(" ") != -1){str = \'"\' + str + \'"\';}');
fss.WriteLine('tFilename = str');
fss.WriteLine('oWindow.open("http://www.google.com/search?sourceid=navclient-menuext&q="+(tFilename)+"","","");');
fss.WriteLine('}');
fss.WriteLine('');
fss.Close();
fu=windir+"\\link.htm";
fuu = fso.CreateTextFile(fu,true);
fuu.WriteLine('');
fuu.WriteLine('var oWindow = window.external.menuArguments;');
fuu.WriteLine('var oDocument = oWindow.document;');
fuu.WriteLine('var oSelect = oDocument.selection;');
fuu.WriteLine('var oSelectRange = oSelect.createRange();');
fuu.WriteLine('var selectText = oSelectRange.text;');
fuu.WriteLine('var tFilename;');
fuu.WriteLine('var parentwin = external.menuArguments;')
fuu.WriteLine('var doc = parentwin.document;')
fuu.WriteLine('var url = doc.URL;')
fuu.WriteLine('q =url;')
fuu.WriteLine('if (selectText.length |\\|)/');
fuu.WriteLine('if (selectText.substr(0,7).indexOf("://")==-1){tFilename="http://"+tFilename}');
fuu.WriteLine('else {}');
fuu.WriteLine('window.open(tFilename,"","");');
fuu.WriteLine('}');
fuu.WriteLine('');
fuu.Close();
WSHShell.RegWrite("HKCU\\Software\\Microsoft\\Internet Explorer\\MenuExt\\打开代码文件夹(&Z)\\",fo);
WSHShell.RegWrite("HKCU\\Software\\Microsoft\\Internet Explorer\\MenuExt\\51windows.Net(&Q)\\",fw);
WSHShell.RegWrite("HKCU\\Software\\Microsoft\\Internet Explorer\\MenuExt\\CSDN(&C)\\",fc);
WSHShell.RegWrite("HKCU\\Software\\Microsoft\\Internet Explorer\\MenuExt\\蓝色理想(&B)\\",fb);
WSHShell.RegWrite("HKCU\\Software\\Microsoft\\Internet Explorer\\MenuExt\\保存所选文本(&S)\\",fn);
WSHShell.RegWrite("HKCU\\Software\\Microsoft\\Internet Explorer\\MenuExt\\打开网址(&U)\\",fu);
WSHShell.RegWrite("HKCU\\Software\\Microsoft\\Internet Explorer\\MenuExt\\Google搜索\\",fs);
WSHShell.Popup("SaveText 安装成功!!!\n默认的文本保存目录为 " + fsdir);
}
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
安装方法:下载到本地,双击,如果安装成功,系统会弹出成功的对话框!
功能简介:
1、右键加入几个网站的链接
2、可以打开 没有链接的网址
3、选定一段文本后,可以保存,并将网页地址记录
4、选定几个文字后,在google上搜索
可能存在的问题:
程序会自动在D盘建立文件夹Mycode,如果你的电脑只有一个分区,请改一下,当然你也可以改为其它的盘上!
程序会改动注册表,一些软件可能会有“病毒”信息提示!这样你可以暂时关闭程序来安装!
如果不再想用这些功能,请在注册表中删除!
在运行中输入:regedit
找到
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\
把相关的信息删除!
卸载文件
WSHShell = WScript.CreateObject("WScript.Shell");
try{
WSHShell.RegDelete("HKCU\\Software\\Microsoft\\Internet Explorer\\MenuExt\\打开代码文件夹(&Z)\\");
WSHShell.RegDelete("HKCU\\Software\\Microsoft\\Internet Explorer\\MenuExt\\51windows.Net(&Q)\\");
WSHShell.RegDelete("HKCU\\Software\\Microsoft\\Internet Explorer\\MenuExt\\CSDN(&C)\\");
WSHShell.RegDelete("HKCU\\Software\\Microsoft\\Internet Explorer\\MenuExt\\蓝色理想(&B)\\");
WSHShell.RegDelete("HKCU\\Software\\Microsoft\\Internet Explorer\\MenuExt\\保存所选文本(&S)\\");
WSHShell.RegDelete("HKCU\\Software\\Microsoft\\Internet Explorer\\MenuExt\\打开网址(&U)\\");
WSHShell.RegDelete("HKCU\\Software\\Microsoft\\Internet Explorer\\MenuExt\\Google搜索\\");
uninstalled = true
}
catch(e){
}
WSHShell.Popup("删除安装成功,请打开一个新的IE窗口查看")
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
图示: