『第
4 楼』:
以下是源码,不能单独运行,需要三个扩展命令(1楼注明了):
对了,一楼的最下面有下载地址....就是图片下面的点此下载............不会没人看到吧.
@echo off
setlocal enabledelayedexpansion
Curs /crv 0
::默认设置
set /a mod_cols=80
set /a mod_lines=20
mode con cols=%mod_cols% lines=%mod_lines%
::背景颜色
set backcolor=b
::链接背景颜色
set linkbackcolor=7
::线条背景颜色
set linebackcolor=b
::默认BEL文件
set belfile=data\menu.bel
::选择框背景颜色
set selectbackcolor=c
::选择框前景颜色
set selectforecolor=e
set /a lnknum=0
set /a boxnum=0
set /a linenum=0
set /a labelnum=0
set title=小强系统优化工具
::检测通过参数调用的文件是否存在,如存在,则设置默认BEL文件为%1
if exist %1 set "belfile=%1"
cls
::设置窗口背景颜色
color %backcolor%0
::读取所有链接
title %title% - 正在读取数据...
::描绘loading...(取消了,浪费时间,要开启可以去掉前面的::)
::call :drawload
for /f "delims=^ tokens=1-7" %%a in (%belfile%) do (
if "%%a"=="link" (
set /a lnknum+=1
set "lnk!lnknum!caption=%%b"
set /a lnk!lnknum!x=%%c
set /a lnk!lnknum!y=%%d
set "lnk!lnknum!url=%%e"
set "lnk!lnknum!color=%%f"
)
if "%%a"=="box" (
set /a boxnum+=1
set /a box!boxnum!x=%%b
set /a box!boxnum!y=%%c
set /a box!boxnum!width=%%d
set /a box!boxnum!height=%%e
set "box!boxnum!backcolor=%%f"
set "box!boxnum!forecolor=%%g"
)
if "%%a"=="line" (
set /a linenum+=1
set /a line!linenum!x=%%b
set /a line!linenum!y=%%c
set /a line!linenum!width=%%d
set "line!linenum!color=%%e"
)
if "%%a"=="label" (
set /a labelnum+=1
set /a label!labelnum!x=%%c
set /a label!labelnum!y=%%d
set "label!labelnum!backcolor=%%e"
set "label!labelnum!forecolor=%%f"
set "label!labelnum!caption=%%b"
)
if "%%a"=="cmd" (%%b)
)
cls
::描绘矩形
for /l %%G in (1,1, %boxnum%) do (
title %title% - 正在描绘矩形:%%G/!boxnum! 在位置:!box%%Gx!,!box%%Gy!
call :drawbox !box%%Gx! !box%%Gy! !box%%Gwidth! !box%%Gheight! !box%%Gbackcolor! !box%%Gforecolor!
)
::描绘线条
for /l %%I in (1,1, %linenum%) do (
title %title% - 正在描绘线条:%%I/!linenum! 在位置:!line%%Ix!,!line%%Iy!
call :drawline !line%%Ix! !line%%Iy! !line%%Iwidth! !line%%Icolor!
)
::描绘链接
for /l %%g in (1,1, %lnknum%) do (
title %title% - 正在描绘链接:%%g/!lnknum! 在位置:!lnk%%gx!,!lnk%%gy!
call :drawlink !lnk%%gx! !lnk%%gy! !lnk%%gcolor! "!lnk%%gcaption!"
)
::描绘标签
for /l %%J in (1,1, %labelnum%) do (
title %title% - 正在描绘标签:%%J/!labelnum! 在位置:!label%%Jx!,!label%%Jy!
call :drawlabel !label%%Jx! !label%%Jy! !label%%Jbackcolor! !label%%Jforecolor! "!label%%Jcaption!"
)
title %title%
set /a curselect=1
set /a oldselect=1
:wait
call :drawlink !lnk%oldselect%x! !lnk%oldselect%y! !lnk%oldselect%color! "!lnk%oldselect%caption!"
call :drawselectbox !lnk%curselect%x! !lnk%curselect%y! "!lnk%curselect%caption!"
pause>nul
set /a oldselect=%curselect%
ckey 37 38 39 40 13 27
if %errorlevel%==1 set /a curselect=%curselect%-1
if %errorlevel%==2 set /a curselect=%curselect%-1
if %errorlevel%==3 set /a curselect=%curselect%+1
if %errorlevel%==4 set /a curselect=%curselect%+1
if %errorlevel%==5 (if not "!lnk%curselect%url!"=="none" !lnk%curselect%url!)
if %errorlevel%==6 exit
if %curselect% lss 1 set /a curselect=%lnknum%
if %curselect% gtr %lnknum% set /a curselect=1
goto wait
:drawbox
::第一个和第二个参数:矩形X,Y位置,第三个参数:矩形宽,第四个参数:矩形高,第五个参数:矩形颜色
set boxwidth=
set /a boxline=%2
for /l %%h in (1,1,%3) do set boxwidth=!boxwidth!─
for /l %%j in (1,1,%1) do set skipx=!skipx!
::设置矩形的第一行
set ostboxline=┌%boxwidth%┒
::设置矩形最后一行
set boxwidth=%boxwidth:─=━%
set lstboxline=┕%boxwidth%┛
::设置矩形中间行
set boxwidth=%boxwidth:━= %
set tstboxline=│%boxwidth%┃
::开始画矩形
curs /pos %1 %boxline%&echox -c %5%6 "%ostboxline%"
for /l %%k in (1,1,%4) do (
set /a boxline+=1
curs /pos %1 !boxline!&echox -c %5%6 "!tstboxline!"
)
set /a boxline+=1
curs /pos %1 %boxline%&echox -c %5%6 "%lstboxline%"
goto :eof
::描绘线条
:drawline
set linewidth=
for /l %%l in (1,1,%3) do set linewidth=!linewidth!─
curs /pos %1 %2&echox -c %linebackcolor%%4 %linewidth%
goto :eof
::描绘链接
:drawlink
curs /pos %1 %2&echox -c %linkbackcolor%%3 %4
goto :eof
::描绘选择框
:drawselectbox
curs /pos %1 %2&echox -c %selectbackcolor%%selectforecolor% %3
goto :eof
::载入提示
:drawload
set /a currc=0
for %%H in (L o a d i n g . . . ) do (
echox -n -c %backcolor%!currc! %%H
set /a currc+=1
)
goto :eof
::描绘标签
:drawlabel
curs /pos %1 %2&echox -c %3%4 %5
goto :eof [ Last edited by czl1378 on 2009-2-22 at 14:13 ]
|