中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

中国DOS联盟论坛
现在时间是 2026-08-02 05:55
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [共同参与][批处理的鼠标小工具] 查看 1,366 回复 2
楼 主 [共同参与][批处理的鼠标小工具] 发表于 2006-10-23 02:19 ·  中国 广西 玉林 博白县 电信
金牌会员
★★★★
积分 3,687
发帖 1,467
注册 2005-08-08 12:00
20年会员
UID 44210
状态 离线
利用现有第三键、滚轮按键功能鼠标,配合它们的可以自定义按键功能的驱动(大部分都可以定义运行某个文件)
再利用 redtek 上传的 Windows Server 2003 的 choice.exe
http://www.cn-dos.net/forum/viewthread.php?tid=24011&fpage=1
制作一个鼠标小工具(驱动定义鼠标第三键、滚轮按键运行该批处理)

例:MTools.bat

@echo off
title 鼠标应用程序
mode con cols=35 lines=1
color 0b
CHOICE /C 123x /T 3 /D x /N /M " 1.记事本 2.计算器 3.命令提示符"
if %errorlevel% == 1 start notepad&exit
if %errorlevel% == 2 start calc&exit
if %errorlevel% == 3 cd/d c:\&start cmd&exit

虽然没有Yz Dock、ObjectDock Plus等华丽的界面、强大的功能,却有着更方便的使用方式和更低的资源占用(可以做成多级菜单方式)

也可以用 IE 制作漂亮的界面(启动稍慢,速度视 IE 界面脚本的大小)

@echo off
title 鼠标应用程序
mode con cols=15 lines=1
color 0b

>%Temp%\List.vbs echo set WshShell = Wscript.CreateObject("Wscript.Shell")
>>%Temp%\List.vbs echo Set fso = Wscript.CreateObject("Scripting.FileSystemObject")
>>%Temp%\List.vbs echo fso.DeleteFile("%Temp%\List.vbs")
>>%Temp%\List.vbs echo set ie=wscript.createobject("internetexplorer.application","event_")
>>%Temp%\List.vbs echo ie.fullscreen=1
>>%Temp%\List.vbs echo ie.width=300
>>%Temp%\List.vbs echo ie.height=56
>>%Temp%\List.vbs echo ie.navigate "about:blank"
>>%Temp%\List.vbs echo ie.left=fix((ie.document.parentwindow.screen.availwidth-ie.width)/2)
>>%Temp%\List.vbs echo ie.top=fix((ie.document.parentwindow.screen.availheight-ie.height)/2)
>>%Temp%\List.vbs echo ie.visible=1

>>%Temp%\List.vbs echo with ie.document
>>%Temp%\List.vbs echo .write "<html><title>鼠标应用程序</title><body background='%Temp%\BlueshowBig.gif' bgcolor=#e3e5da scroll=no>"
>>%Temp%\List.vbs echo .write "<table width=240 bgcolor=#e7f1fa border=0 cellpadding=0 cellspacing=2 style='position:absolute;left:0;top:0;font-family:Tahoma,宋体;font-size:15px;color:#698cc2;border:#698cc2 1px solid';>"
>>%Temp%\List.vbs echo .write "<tr align=center bgcolor=#698cc2 style=color:#ffffff;><td><b>------选择项目------</b></font></td></tr><tr><td>"
>>%Temp%\List.vbs echo .write "&nbsp;<input id=notepad type=button value=记事本 name=R1>"
>>%Temp%\List.vbs echo .write "&nbsp;<input id=calc type=button value=计算器 name=R1>"
>>%Temp%\List.vbs echo .write "&nbsp;<input id=cmd type=button value=命令提示符 name=R1><br>"
>>%Temp%\List.vbs echo .write "</td></tr></table></body>"
>>%Temp%\List.vbs echo .write "<body oncontextmenu='return false' ondragstart='return false' onselectstart ='return false' onselect='document.selection.empty()' oncopy='document.selection.empty()' onbeforecopy='return false'onmouseup='document.selection.empty()'></body></html>"
>>%Temp%\List.vbs echo end with

>>%Temp%\List.vbs echo dim wmi
>>%Temp%\List.vbs echo set wnd=ie.document.parentwindow
>>%Temp%\List.vbs echo set id=ie.document.all
>>%Temp%\List.vbs echo id.notepad.onclick=getref("notepad")
>>%Temp%\List.vbs echo id.calc.onclick=getref("calc")
>>%Temp%\List.vbs echo id.cmd.onclick=getref("cmd")

>>%Temp%\List.vbs echo do while true
>>%Temp%\List.vbs echo wscript.sleep 200
>>%Temp%\List.vbs echo WshShell.AppActivate ("鼠标应用程序 - Microsoft Internet Explorer")
>>%Temp%\List.vbs echo wscript.sleep 3000
>>%Temp%\List.vbs echo Wscript.Echo "exit"
>>%Temp%\List.vbs echo ie.quit
>>%Temp%\List.vbs echo loop

>>%Temp%\List.vbs echo sub event_onquit
>>%Temp%\List.vbs echo wscript.quit
>>%Temp%\List.vbs echo end sub

>>%Temp%\List.vbs echo sub notepad
>>%Temp%\List.vbs echo Wscript.Echo "notepad"
>>%Temp%\List.vbs echo ie.quit
>>%Temp%\List.vbs echo end sub

>>%Temp%\List.vbs echo sub calc
>>%Temp%\List.vbs echo Wscript.Echo "calc"
>>%Temp%\List.vbs echo ie.quit
>>%Temp%\List.vbs echo end sub

>>%Temp%\List.vbs echo sub cmd
>>%Temp%\List.vbs echo Wscript.Echo "cmd"
>>%Temp%\List.vbs echo ie.quit
>>%Temp%\List.vbs echo end sub

for /f "tokens=*" %%i in ('"cscript //nologo %Temp%\List.vbs"') do (
if "%%i"=="notepad" start notepad&exit
if "%%i"=="calc" start calc&exit
if "%%i"=="cmd" cd/d c:\&start cmd&exit)
if "%%i"=="exit" exit)
exit

上面一段最好使用 Quick BFC 打包为幽灵程序使用
(本人显示器设定 120 DPI 字体,大多数人 96 DPI 字体方式显示界面可能不正确,修改“width=300”“height=56”即可)
2 发表于 2006-10-23 02:42 ·  中国 四川 成都 教育网
铂金会员
★★★★
积分 7,493
发帖 2,672
注册 2005-09-02 00:00
20年会员
UID 42173
性别 男
状态 离线
我的 Maxthon 会拦截 internetexplorer.application 弹出的窗口,郁闷。

所以我一般用 htmlfile 来做了。基本放弃了 internetexplorer.application

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>"
3 发表于 2006-10-23 02:43 ·  中国 四川 成都 电信
新手上路
积分 6
发帖 3
注册 2006-10-19 13:22
19年会员
UID 66939
状态 离线
我是新手 什么都不懂 来论坛是学习的 !
论坛跳转: