前天有位兄台发了个,感觉很好玩,回家就自己写了个- @echo off&setlocal enabledelayedexpansion
- title 点阵生成-解释器
- :begin
- cls&color 3f&mode con cols=50 lines=16
- set fore=&set back=&call :blank 5
- set file=&set/p file= 拖入点阵文件到这里:
- if not defined file goto begin
- if not exist %file% goto begin
- type %file%|findstr "[0-9]"|findstr "\-" >nul 2>nul&&goto explain
- :_crate //**点阵生成编码**//
- call :foreback %file%
- call :file_name_path 编码
- >"%tee%" echo/%fore%%back%
- :crate
- cls&call :blank 5
- echo 程序检测到前景为[%fore%]背景为[%back%]
- echo 输入任意字母互换前背景,默认直接回车
- echo/&set choices=&set/p choices= please choice:
- if defined choices (call :change back fore&goto crate)
- for /f "delims=" %%a in ('findstr/n ".*" "%_path%"') do (
- set "var=%%a"&set var=!var:*:=!&set "m="&set "n="
- if defined var (call :totext&echo/>>"%tee%") else echo/>>"%tee%"
- )
- echo/&echo 生成编码成功!
- ping /n 2 127.1>nul&goto begin
- :explain //**编码解释成点阵**//
- cls&call :blank 5
- echo 输入任意字母彩色显示,默认颜色直接回车
- echo/&set input=&set/p input= please input:
- cls&mode con cols=120 lines=60
- call :file_name_path
- set/p fb=<"%_path%"
- set "fore=%fb:~,1%"&set "back=%fb:~1%"
- if defined input <nul set/p= >%fore%
- for /f "skip=1 delims=" %%a in ('findstr/n ".*" "%_path%"') do (
- set "_var=%%a"&set _var=!_var:*:=!
- if defined _var (
- for %%b in (!_var!) do (
- if %%b gtr 0 (for /l %%c in (1,1,%%b) do <nul set/p=%back%) else (
- if defined input (
- set "_color=0123456789abcdef"
- set/a x=!random!%%16
- for %%i in (!x!) do set "_color=!_color:~%%i,1!"
- for /l %%c in (%%b,1,-1) do findstr /a:!_color! . %fore%*
- ) else (for /l %%c in (%%b,1,-1) do <nul set/p=%fore%)
- )
- )
- echo/
- ) else echo/
- )
- if defined input del %fore%>nul
- call :blank 3
- pause>nul&goto begin
- :foreback //**获取前背景**//
- for /f "usebackq delims=" %%i in ("%~1") do (
- set "str=%%i"
- if not defined back set back=!str:~,1!
- call,set fore=%%str:!back!=%%
- if defined fore (
- set "fore=!fore:~,1!"
- if "!fore!" equ " " call :change back fore
- if "!fore!" equ " " call :change back fore
- goto :eof
- )
- )
- goto :eof
- :blank //**产生空行**//
- for /l %%i in (1,1,%1) do echo/
- goto :eof
- :change //**交换前背景**//
- set %1=%fore%&set %2=%back%&goto :eof
- :file_name_path //**文件名称,路径格式化**//
- for %%i in (%file%) do (set "dire=%%~dpi"&set "_path=%%~fi"&set "tee=!dire!%%~ni_%1.txt")
- goto :eof
- :totext //**逐个截取统计成编码写入文本**//
- if defined var (
- set #var=%var:~,1%
- if "!#var!" neq "%fore%" (
- set/a n+=1&if defined m (>>"%tee%" <nul set/p=-%m% &set "m=")
- ) else (set/a m+=1&if defined n (>>"%tee%" <nul set/p=%n% &set "n=")
- )
- set var=!var:~1!
- goto totext
- )
- if defined n (>>"%tee%" <nul set/p=%n% ) else (
- >>"%tee%" <nul set/p=-%m%
- )
- goto :eof
复制代码 测试文本-
-
- ▓ ▓ ▓ ▓ ▓ ▓▓▓▓▓▓▓
- ▓ ▓ ▓ ▓ ▓ ▓▓▓▓▓ ▓ ▓
- ▓▓▓▓ ▓ ▓ ▓▓▓▓ ▓ ▓ ▓▓▓▓▓▓▓
- ▓ ▓ ▓ ▓ ▓ ▓ ▓▓ ▓ ▓ ▓ ▓
- ▓ ▓▓ ▓▓ ▓ ▓ ▓ ▓ ▓▓▓▓▓ ▓ ▓
- ▓▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓▓▓▓▓▓▓
- ▓▓▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓
- ▓ ▓ ▓ ▓ ▓ ▓ ▓▓▓▓▓
- ▓ ▓ ▓▓ ▓ ▓ ▓ ▓▓ ▓
- ▓ ▓▓ ▓ ▓ ▓ ▓▓ ▓ ▓▓ ▓
- ▓▓▓ ▓ ▓▓▓ ▓▓ ▓▓▓▓▓ ▓▓▓▓▓▓▓▓
-
-
复制代码 随风代码中的几个字-
- ● ● ● ●●●● ●●●●●●●●● ● ●
- ● ● ● ●●●●● ● ● ● ●●●●●●●●●●●
- ● ● ● ● ●●●● ● ● ●
- ●●●●●●●●● ● ● ● ● ● ● ● ●
- ●● ● ●●●● ● ●● ●●●●●●●●●●● ●●● ●●●
- ● ● ● ● ● ● ● ● ●
- ● ●● ●●●●●●●●● ● ● ●●●● ●●●●●
- ● ● ● ● ● ●
- ● ● ● ●●●●●●● ● ● ● ● ● ●●
- ● ● ● ● ● ● ● ● ● ● ●
- ●● ● ●●●●●●●●●●● ●● ●● ● ●●●●●● ●
-
-
-
- ● ● ● ● ● ● ● ●
- ● ● ●●●● ● ● ● ● ● ●
- ●●●●●●●●● ● ● ●●●●●●●●● ●● ● ●
- ●● ● ●●●●●●●●●●● ● ● ● ● ● ●●● ●
- ●● ● ● ● ● ● ● ●●● ● ●
- ● ● ●●●●● ● ●● ● ● ● ● ● ●●●●●
- ● ●● ● ●●● ● ● ●●●●●●●●● ●
- ●● ● ● ●● ● ● ● ●●●●●●●●●●●
- ● ● ● ● ●● ● ● ●
- ● ● ● ●●● ● ● ● ●
- ● ●●●●● ●●● ●● ● ●
-
-
复制代码 不能插入截图,是不是等级不够啊
如要交换前背景,即反色显示,必须前背景全半角一致
代码完全是自己的思路,如有雷同纯属巧合!
更新了下,增加了彩色显示功能。。。 |