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/
[ Last edited by Nai Wu He on 2007-1-4 at 01:16 AM ]
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/
Nai Wu He posted on 2007-01-03 12:11
- :::::::::::::::::::::::::::::::::::::::::::::::::
- :: 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
[ Last edited by Nai Wu He on 2007-1-4 at 01:16 AM ]
Recent Ratings for This Post
( 6 in total)
Click for details
☆开始\运行 (WIN+R)☆
%ComSpec% /cset,=何奈无── 。何奈可无是原,事奈无做人奈无&for,/l,%i,in,(22,-1,0)do,@call,set/p= %,:~%i,1%<nul&ping/n 1 127.1>nul
%ComSpec% /cset,=何奈无── 。何奈可无是原,事奈无做人奈无&for,/l,%i,in,(22,-1,0)do,@call,set/p= %,:~%i,1%<nul&ping/n 1 127.1>nul
