|
andred0421
初级用户
 
积分 114
发帖 47
注册 2006-11-20
状态 离线
|
『楼 主』:
如何实现 选项内容,标号从文本文件中获取
使用 LLM 解释/回答一下
echo ╭────────╮
echo ╭─────┤ 选项 ├─────────╮
echo │ ╰────────╯ │
echo │ 1. ++++++++ │
echo │ │
echo │ 2. fdfdfd │
echo │ │
echo │ 3. gfgfg │
echo │ │
echo ╰──────────────────────────╯
echo.
如何实现 选项内容,标号从同目录下的文本文件中获取,
文本文件格式:
1. ++++++++
2. fdfdfd
3. gfgfg
echo ╭────────╮
echo ╭─────┤ Options ├─────────╮
echo │ ╰────────╯ │
echo │ 1. ++++++++ │
echo │ │
echo │ 2. fdfdfd │
echo │ │
echo │ 3. gfgfg │
echo │ │
echo ╰──────────────────────────╯
echo.
How to implement the option content, where the numbers are obtained from a text file in the same directory,
The text file format:
1. ++++++++
2. fdfdfd
3. gfgfg
|
|
2006-12-13 09:46 |
|
|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
可以实现,但是读取之后不一定能保证是一个矩形框。
It can be achieved, but after reading, it is not necessarily guaranteed to be a rectangular box.
|
|
2006-12-13 10:08 |
|
|
redtek
金牌会员
     
积分 2902
发帖 1147
注册 2006-9-21
状态 离线
|
 『第 3 楼』:
使用 LLM 解释/回答一下
@echo %dbg% off && setlocal enabledelayedexpansion
:: 全长: 60
:: 菜单偏移量: 18
:: 提取: ~0,59 (最后一位补“│”字符)
:: 公式: 补 │
set "space= "
set "vol= │ "
echo ╭────────╮
echo ╭─────┤ 选项 ├─────────╮
echo │ ╰────────╯ │
for /f "tokens=1* delims=" %%i in (menu.txt) do (
set a=%vol%%%i%space%
echo !a:~0,59!│
echo │ │
)
echo │ │
echo │ │
echo │ │
echo ╰────────────────────────╯
echo.
贴上来格式看上去很乱,做好的源码和菜单文件压缩成附件上传了,方便楼主调试:)
```
@echo %dbg% off && setlocal enabledelayedexpansion
:: Total length: 60
:: Menu offset: 18
:: Extraction: ~0,59 (last character filled with "│" character)
:: Formula: fill with │
set "space= "
set "vol= │ "
echo ╭────────╮
echo ╭─────┤ Options ├─────────╮
echo │ ╰────────╯ │
for /f "tokens=1* delims=" %%i in (menu.txt) do (
set a=%vol%%%i%space%
echo !a:~0,59!│
echo │ │
)
echo │ │
echo │ │
echo │ │
echo ╰────────────────────────╯
echo.
```
The pasted format looks messy. The completed source code and menu file are compressed into an attachment and uploaded, which is convenient for the landlord to debug: )
此帖被 +15 点积分 点击查看详情 评分人:【 lxmxn 】 | 分数: +5 | 时间:2006-12-14 00:51 | 评分人:【 ccwan 】 | 分数: +5 | 时间:2006-12-14 00:52 | 评分人:【 a9319751 】 | 分数: +3 | 时间:2006-12-14 01:06 | 评分人:【 hxuan999 】 | 分数: +2 | 时间:2006-12-14 02:33 |
|
附件
1: menu.rar (2006-12-13 11:30, 506 bytes, 下载附件所需积分 1 点
,下载次数: 47)
|

Redtek,一个永远在网上流浪的人……
_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._ |
|
2006-12-13 11:30 |
|
|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
Redtek 兄写的精彩啊。加分~~
Brother Redtek wrote wonderfully. Add points~~
|
|
2006-12-14 00:51 |
|
|
ccwan
金牌会员
     
积分 2725
发帖 1160
注册 2006-9-23 来自 河北廊坊
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
抗议!偶加分太受限制了。
Protest! I am too restricted in adding points.
|

三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。 |
|
2006-12-14 00:53 |
|
|
无奈何
荣誉版主
      
积分 1338
发帖 356
注册 2005-7-15
状态 离线
|
 『第 6 楼』:
使用 LLM 解释/回答一下
RE redtek 兄
发帖时选择字体为 “宋体” 可以实现等宽显示了。
RE redtek 兄
When posting, selecting the font "SimSun" can achieve monospacing display.
|

☆开始\运行 (WIN+R)☆
%ComSpec% /cset,=何奈无── 。何奈可无是原,事奈无做人奈无&for,/l,%i,in,(22,-1,0)do,@call,set/p= %,:~%i,1%<nul&ping/n 1 127.1>nul
|
|
2006-12-14 02:32 |
|
|
HUNRYBECKY
银牌会员
    
积分 1179
发帖 442
注册 2006-9-9
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
Originally posted by redtek at 2006-12-13 11:30:
@echo %dbg% off && setlocal enabledelayedexpansion
:: 全长: 60
:: 菜单偏移量: 18
:: 提取: ~0,59 (最后一位补“│”字符)
:: 公式 ...
建议兄再改下代码。测试兄的代码,如果使用原菜单memu.txt中的内容,菜单不是乱的,如果我修改menu.txt中的内容则菜单就变了,关键是最后的“|”字符错位,如果能实现以下功能则爽:
1。让用户随意自定义memu.txt中的内容,
2。把用户定义的菜单项目保存到变量中以便实现跳转到对应的菜单程序。
Originally posted by redtek at 2006-12-13 11:30:
@echo %dbg% off && setlocal enabledelayedexpansion
:: Total length: 60
:: Menu offset: 18
:: Extraction: ~0,59 (complement the last character with "│" character)
:: Formula ...
It is suggested that you modify the code further. When testing your code, if the content in the original menu memu.txt is used, the menu is not messy. But if I modify the content in menu.txt, the menu changes. The key is that the final "|" character is misaligned. If the following functions can be realized, it will be great:
1. Let users freely customize the content in memu.txt,
2. Save the user-defined menu items to variables to realize jumping to the corresponding menu program.
|
|
2006-12-14 05:07 |
|
|
zh159
金牌会员
     
积分 3687
发帖 1467
注册 2005-8-8
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
对于含有汉字的用以上方法就会出现最后的“|”字符错位
所以最好能算出字节
Last edited by zh159 on 2006-12-13 at 04:25 PM ]
For the content containing Chinese characters, using the above method will result in the final "|" character being misaligned. So it is best to calculate the number of bytes.
Last edited by zh159 on 2006-12-13 at 04:25 PM ]
|
|
2006-12-14 05:24 |
|
|
zhangqing1123
新手上路

积分 2
发帖 1
注册 2008-5-31
状态 离线
|
|
2008-6-1 10:14 |
|