|
无奈何
荣誉版主
      
积分 1338
发帖 356
注册 2005-7-15
状态 离线
|
   『楼 主』:
[原创]批处理在线查单词
使用 LLM 解释/回答一下
昨天写完的东西,忘发了。功能简单在线查单词,数据来自金山词霸。
需要 wget 或 curl 支持,如果需要朗读功能的话需要 mplayer 支持。
用法:dict word ...
/F 完全模式查询单词。
word 可指定多个单词。
支持单词朗读功能。
所需软件链接:
mplayer: http://www.mplayerhq.hu
wget : http://users.ugent.be/~bpuype/wget/
或 curl: http://curl.haxx.se/
- :::::::::::::::::::::::::::::::::::::::::::::::::
- :: dict.cmd -V0.1 -- 批处理在线查单词
- :: 无奈何@cn-dos.net - 2007-1-2
- :: 用法:dict word ...
- :: 支持文件: - mplayer.exe wget.exe or curl.exe
- :::::::::::::::::::::::::::::::::::::::::::::::::
- @echo off
- setlocal ENABLEDELAYEDEXPANSION
- set mp3file="%TEMP%\dict.mp3"
- rem 依赖文件检查
- :mplay
- call mplayer >nul 2>nul
- if "%ERRORLEVEL%" == "1" set nomplay=1
- :wget
- wget.exe >nul 2>nul
- if not "%ERRORLEVEL%" == "9009" (
- set "command1=wget -q -O - "
- set "command2=wget -q -O %mp3file%"
- goto star
- )
- :curl
- curl.exe >nul 2>nul
- if not "%ERRORLEVEL%" == "9009" (
- set "command1=curl -s "
- set "command2=curl -s -o %mp3file%"
- goto star
- )
- echo.本脚本需要 wget 或 curl 的支持。
- goto :EOF
- :star
- set flag=0
- if "%~1" == "" goto help
- if "%~1" == "?" goto help
- if "%~1" == "/?" goto help
- if "%~1" == "/F" shift &goto full
- if "%~1" == "/f" shift &goto full
- :next
- if "%~1" == "" goto :EOF
- set "word=%~1"
- call :down
- shift
- goto :next
- :full
- if "%~1" == "" goto :EOF
- set mp3=
- del %mp3file% 2>nul
- set "word=%~1"
- call :down
- %command2% "%mp3%"
- echo.--------------------------------
- if "%mp3%" == "" echo.查看详解 退出 &goto :Nselect
- echo.朗读 查看详解 退出
- :Nselect
- set select=
- set /p select=请选择:
- call :Parse
- if "%quit%" == "1" goto :EOF
- shift
- goto :full
- :Parse
- for %%s in (R r F f A a) do if "%%s" == "%select%" goto Switch%select%
- goto :EOF
- :SwitchR
- if "%nomplay%" == "1" echo. 播放影音需要 mplayer 支持。&goto :Nselect
- start /min %ComSpec% /c "mplayer %mp3file%>nul"
- goto :Nselect
- goto :EOF
- :SwitchF
- start http://www.iciba.com/search?s=%word%
- goto :Nselect
- goto :EOF
- :SwitchA
- set quit=1
- goto :EOF
- :down
- set url="http://dict.cn/ws.php?q=%word%"
- echo.
- echo.单词:%word%
- echo.释义:
- for /f "tokens=1,2,3 delims=<>" %%a in ('%command1% %url%') do (
- if "%%a" == "audio" set "mp3=%%b"
- if "%%b" == "Not Found" echo 无此单词^^! &goto :EOF
- if "%%c" == "/def" echo %%b &goto :EOF
- if "%%b" == "/def" echo %%a &set flag=0
- if "!flag!" == "1" echo %%a
- if "%%a" == "def" echo %%b &set flag=1
- )
- goto :EOF
- :help
- echo.批处理在线查单词
- echo.
- echo.用法:dict word ...
- echo.
- echo /F 完全模式查询单词。
- echo word 可指定多个单词。
- goto :EOF
无奈何发表于 2007-01-03 12:11
Last edited by 无奈何 on 2007-1-4 at 01:16 AM ]
The things written yesterday were forgotten to be posted. It's a simple online word lookup with data from Kingsoft Ciba.
Requires support for wget or curl. If you need the朗读 function, support for mplayer is required.
Usage: dict word ...
/F: Query the word in full mode.
word: Multiple words can be specified.
Supports word朗读 function.
Links to required software:
mplayer: http://www.mplayerhq.hu
wget: http://users.ugent.be/~bpuype/wget/
or curl: http://curl.haxx.se/
- :::::::::::::::::::::::::::::::::::::::::::::::::
- :: dict.cmd -V0.1 -- Batch online word lookup
- :: Nai Wu He@cn-dos.net - 2007-1-2
- :: Usage: dict word ...
- :: Dependent files: - mplayer.exe wget.exe or curl.exe
- :::::::::::::::::::::::::::::::::::::::::::::::::
- @echo off
- setlocal ENABLEDELAYEDEXPANSION
- set mp3file="%TEMP%\dict.mp3"
- rem Check dependent files
- :mplay
- call mplayer >nul 2>nul
- if "%ERRORLEVEL%" == "1" set nomplay=1
- :wget
- wget.exe >nul 2>nul
- if not "%ERRORLEVEL%" == "9009" (
- set "command1=wget -q -O - "
- set "command2=wget -q -O %mp3file%"
- goto star
- )
- :curl
- curl.exe >nul 2>nul
- if not "%ERRORLEVEL%" == "9009" (
- set "command1=curl -s "
- set "command2=curl -s -o %mp3file%"
- goto star
- )
- echo.This script requires support for wget or curl.
- goto :EOF
- :star
- set flag=0
- if "%~1" == "" goto help
- if "%~1" == "?" goto help
- if "%~1" == "/?" goto help
- if "%~1" == "/F" shift &goto full
- if "%~1" == "/f" shift &goto full
- :next
- if "%~1" == "" goto :EOF
- set "word=%~1"
- call :down
- shift
- goto :next
- :full
- if "%~1" == "" goto :EOF
- set mp3=
- del %mp3file% 2>nul
- set "word=%~1"
- call :down
- %command2% "%mp3%"
- echo.--------------------------------
- if "%mp3%" == "" echo. View detailed explanation Exit &goto :Nselect
- echo. Read aloud View detailed explanation Exit
- :Nselect
- set select=
- set /p select=Please select:
- call :Parse
- if "%quit%" == "1" goto :EOF
- shift
- goto :full
- :Parse
- for %%s in (R r F f A a) do if "%%s" == "%select%" goto Switch%select%
- goto :EOF
- :SwitchR
- if "%nomplay%" == "1" echo. Playing audio requires support for mplayer. &goto :Nselect
- start /min %ComSpec% /c "mplayer %mp3file%>nul"
- goto :Nselect
- goto :EOF
- :SwitchF
- start http://www.iciba.com/search?s=%word%
- goto :Nselect
- goto :EOF
- :SwitchA
- set quit=1
- goto :EOF
- :down
- set url="http://dict.cn/ws.php?q=%word%"
- echo.
- echo.Word: %word%
- echo.Explanation:
- for /f "tokens=1,2,3 delims=<>" %%a in ('%command1% %url%') do (
- if "%%a" == "audio" set "mp3=%%b"
- if "%%b" == "Not Found" echo No such word^^! &goto :EOF
- if "%%c" == "/def" echo %%b &goto :EOF
- if "%%b" == "/def" echo %%a &set flag=0
- if "!flag!" == "1" echo %%a
- if "%%a" == "def" echo %%b &set flag=1
- )
- goto :EOF
- :help
- echo.Batch online word lookup
- echo.
- echo.Usage: dict word ...
- echo.
- echo /F Query the word in full mode.
- echo word Multiple words can be specified.
- goto :EOF
Nai Wu He posted on 2007-01-03 12:11
Last edited by Nai Wu He on 2007-1-4 at 01:16 AM ]
此帖被 +43 点积分 点击查看详情 评分人:【 ccwan 】 | 分数: +15 | 时间:2007-1-4 01:25 | 评分人:【 redtek 】 | 分数: +11 | 时间:2007-1-4 03:14 | 评分人:【 lxmxn 】 | 分数: +8 | 时间:2007-1-4 05:55 | 评分人:【 huzixuan 】 | 分数: +4 | 时间:2007-3-17 06:30 | 评分人:【 0401 】 | 分数: +4 | 时间:2007-3-17 09:26 | 评分人:【 chengbiner 】 | 分数: +1 | 时间:2007-3-17 11:24 |
|
|

☆开始\运行 (WIN+R)☆
%ComSpec% /cset,=何奈无── 。何奈可无是原,事奈无做人奈无&for,/l,%i,in,(22,-1,0)do,@call,set/p= %,:~%i,1%<nul&ping/n 1 127.1>nul
|
|
2007-1-4 00:47 |
|
|
ccwan
金牌会员
     
积分 2725
发帖 1160
注册 2006-9-23 来自 河北廊坊
状态 离线
|
|
2007-1-4 01:26 |
|
|
redtek
金牌会员
     
积分 2902
发帖 1147
注册 2006-9-21
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
欣赏~~
内容越来越全面、越来越丰富吸引人了~:)))
Appreciate~~
The content is becoming more comprehensive and more attractive~~ :)))
|

Redtek,一个永远在网上流浪的人……
_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._ |
|
2007-1-4 03:15 |
|
|
flamey
初级用户
 
积分 152
发帖 74
注册 2005-12-1
状态 离线
|
|
2007-1-4 03:55 |
|
|
ksuday
初级用户
 
积分 38
发帖 19
注册 2006-10-22
状态 离线
|
|
2007-1-4 04:29 |
|
|
dosmania
初级用户
 
积分 172
发帖 54
注册 2007-1-2
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
不行吖,双击后一闪然后就退出了
我已经下载了wget了,存于WINDOWS吗,我也试了存于system32
结果还是一样
It doesn't work. After double-clicking, it flashes and then exits. I have already downloaded wget and stored it in WINDOWS, and I also tried storing it in system32. The result is still the same.
|
|
2007-1-4 05:35 |
|
|
ccwan
金牌会员
     
积分 2725
发帖 1160
注册 2006-9-23 来自 河北廊坊
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
发错了,汗一个!=_=|||
Last edited by ccwan on 2007-1-4 at 05:55 AM ]
Sent by mistake, sigh! =_=|||
Last edited by ccwan on 2007-1-4 at 05:55 AM ]
|

三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。 |
|
2007-1-4 05:47 |
|
|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
没有金山的词库,有的朋友可否发一个上来?
Without the word library of Kingsoft, can some friends send one up?
|
|
2007-1-4 05:53 |
|
|
vkill
金牌会员
     
积分 4103
发帖 1744
注册 2006-1-20 来自 甘肃.临泽
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
呵呵,以前简单的弄了下,没有去完善,佩服斑竹,要我弄的话是wget+sed
Hehe, I did it simply before, didn't perfect it. Admire the moderator. If it were up to me, it would be wget + sed
|
|
2007-1-4 06:25 |
|
|
vkill
金牌会员
     
积分 4103
发帖 1744
注册 2006-1-20 来自 甘肃.临泽
状态 离线
|
|
2007-1-4 06:29 |
|
|
无奈何
荣誉版主
      
积分 1338
发帖 356
注册 2005-7-15
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
RE dosmania
干嘛要双击运行,这样你只能看到帮助并且一闪而过,在命令行下调用。
RE lxmxn
不需要词库的,在线查。你说的是金山词霸的词典吗?
RE vkill
声音是 mp3 格式的。 http://www.iciba.com/ 的是swf 的。
RE dosmania
Why double-click to run? Then you can only see the help and it flashes by. Call it in the command line.
RE lxmxn
No need for a thesaurus, look up online. Are you talking about the dictionary of Kingsoft PowerWord?
RE vkill
The sound is in mp3 format. http://www.iciba.com/ is swf format.
|

☆开始\运行 (WIN+R)☆
%ComSpec% /cset,=何奈无── 。何奈可无是原,事奈无做人奈无&for,/l,%i,in,(22,-1,0)do,@call,set/p= %,:~%i,1%<nul&ping/n 1 127.1>nul
|
|
2007-1-4 07:19 |
|
|
vkill
金牌会员
     
积分 4103
发帖 1744
注册 2006-1-20 来自 甘肃.临泽
状态 离线
|
|
2007-1-6 02:15 |
|
|
xiaoshuq
初级用户
 
积分 97
发帖 30
注册 2006-12-30
状态 离线
|
『第 13 楼』:
顶
使用 LLM 解释/回答一下
越来越有意思了,看来我要努力学习了阿
It's getting more and more interesting. It seems I need to study hard.
|
|
2007-1-7 02:37 |
|
|
jackyggt
初级用户
 
积分 76
发帖 38
注册 2007-3-13
状态 离线
|
|
2007-3-16 08:00 |
|
|
xycoordinate
中级用户
  
积分 493
发帖 228
注册 2007-2-16 来自 安徽
状态 离线
|
|
2007-3-17 05:52 |
|