Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3895296
  • 博文数量: 534
  • 博客积分: 10470
  • 博客等级: 上将
  • 技术积分: 4800
  • 用 户 组: 普通用户
  • 注册时间: 2006-05-26 14:08
文章分类

全部博文(534)

文章存档

2021年(1)

2019年(1)

2017年(1)

2016年(2)

2013年(2)

2012年(10)

2011年(43)

2010年(10)

2009年(17)

2008年(121)

2007年(253)

2006年(73)

分类:

2007-10-27 12:48:46

今天看文档的时候突然想到的。

有个代码的注释单词不认识:
    eg: reside

没办法得打开金山翻译,看了翻译工具有两种
    1>. 安装在机器上的桌面上的。
我使用起来的缺点:
    a>. 看的好好的,不认识的时候得拿起鼠标把它打开。不怎么方便。得来回切换。

    2>. 使用如: 的网站来就可以了。
我使用起来的缺点:
    a>. 一样也必须鼠标,但这个比上面那得到的信息更多,内容更好点。
    b>. 要上网

自己机器到是可以24小时上网,但不想用鼠标,还想看到的信息想2>中那么多, 怎么办?

要是有个命令就好了:
    eg:
我要查单词 reside
就直接输入:
    xdict reside
下面就可以直接显示相关的单词信息就好了。

简单的想了一下,自己不知道能不能写个,出来用用也挺好的。

访问 上的内容,将结果分析后显示就OK了。怎么分析呢? 在学习中 ......

--------------------------
刚才google了一下, 看到一个用脚本实现的:
来源:
多谢无奈何版主!

:::::::::::::::::::::::::::::::::::::::::::::::::
:: dict.cmd -V0.1 -- 批处理在线查单词
:: 无奈何@cn-dos.net - 2007-1-2
:: 用法:dict [/F] 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.[F]查看详解 [Q/A]退出 &goto :Nselect
echo.[R]朗读 [F]查看详解 [Q/A]退出
: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="%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 [/F] word ...
echo.
echo /F 完全模式查询单词。
echo word 可指定多个单词。
goto :EOF


哈哈。。 实现了,http://blog.chinaunix.net/u/19782/showart_408985.html

阅读(2200) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~