更新提示:
1、更新了回退删除,对输出的字现在也能回退删除;
2、加入了输入法切换功能,可以随时切换输入法;
3、因论坛处理不了tab键,请将代码中的tab字符替换为实际的tab键。- @echo off&setlocal enabledelayedexpansion
-
- :::::::::::初始化变量:::::::::::
- title 拼音^&五笔输入- made by batman
- echo.&set /p=请选择输入法(五笔:w 拼音:p)<nul
- choice /n /c "wp"
- if "%errorlevel%" equ "1" (
- set "file=wbzk.txt"&set "kk=五笔"
- ) else (
- set "file=pyzk.txt"&set "kk=拼音"
- )
- for /l %%a in (0,1,9) do set /a n+=1&set ".!n!=%%a"
- set "code=a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1"&set /a n=0
- for %%a in (%code%) do set /a n+=1&set "_!n!=%%a"
- set /a n=0
- :::::::::::初始化变量:::::::::::
-
- :::::::::::输入法切换及编码输入:::::::::::
- :begin
- title %kk%输入- made by batman
- cls&echo.&echo 输出:%var%&echo.&echo.
- set /p=%wrong1%请正确输入%kk%,"1"切换输入法,"0"回退删除,"z"确认结尾:%str%<nul
- choice /n /c "%code: =%"
- if %errorlevel% gtr 26 (
- if %errorlevel% equ 28 (
- if %file% equ wbzk.txt (
- set "file=pyzk.txt"&set "kk=拼音"
- ) else (
- set "file=wbzk.txt"&set "kk=五笔"
- )
- ) else (
- if defined str (
- set "str=%str:~,-1%"
- ) else (
- if defined var set "var=%var:~,-1%"
- )
- set "wrong1="
- )
- goto begin
- )
- ) else (
- if %errorlevel% lss 26 set "flag=a"
- if not defined flag (
- set "str=%str%!_%errorlevel%!"&goto begin
- ) else (
- if %errorlevel% lss 26 set "str=%str%!_%errorlevel%!"&goto begin
- )
- )
- :::::::::::输入法切换及编码输入:::::::::::
-
- :::::::::::查找字库:::::::::::
- findstr /i "^%str%\>" %file%>nul 2>nul
- if %errorlevel% equ 0 (
- echo.
- for /f "tokens=2" %%a in ('findstr /i "^%str%\>" %file%') do set /a n+=1&set "#!n!=%%a"
- echo.
- ) else (
- set "wrong1=%kk%输入错误,"&set "str="&set "flag="&goto begin
- )
- if %n% equ 1 set "var=%var%%#1%"&goto next
- if %n% gtr 95 (
- set /a min=n,max=1,step=-1
- ) else (
- set /a min=1,max=n,step=1
- )
- :::::::::::查找字库:::::::::::
-
- :::::::::::选项输出及选择:::::::::::
- :lp
- cls&echo.&echo 输出:%var%&echo.&echo.
- set /p=%wrong1%请正确输入%kk%,,"1"切换输入法,"0"回退删除,"z"确认结尾:%str%<nul
- echo.&echo.
- for /l %%a in (%min%,%step%,%max%) do set /p=^(%%a^)tab!#%%a!tab<nul
- echo.&echo.
- set /p=%wrong2%请正确输入序号选择,以"z"确认结尾,输入"a"默认为序号^(1^)选项:%num%<nul
- choice /n /c "0123456789az"
- if %errorlevel% equ 11 set "var=%var%%#1%"&goto next
- if %errorlevel% neq 12 set "num=%num%!.%errorlevel%!"&goto lp
- if not defined #%num% set "wrong2=序号输入错误,"&set "num="&goto lp
- set "var=%var%!#%num%!"
- :::::::::::选项输出及选择:::::::::::
-
- :::::::::::清空变量再循环:::::::::::
- :next
- for %%a in (str num n flag wrong1 wrong2) do set "%%a="
- for /f "delims==" %%a in ('set #') do set "%%a="
- goto begin
- :::::::::::清空变量再循环:::::::::::
复制代码
|