I am attempting to make a Batch program that, when a word (eg. "coding") is inputted, its corresponding definition is outputted.
What I have tried:
1) Downloading lists of all acceptable English words, but I can't find any lists that include definitions.
2) I had an idea that I was unable to try because of insufficient knowledge. When this is searched on Google.com a little box comes up with a concise definition of the word "coding." I was wondering if some method could be used to search Google from a batch file and output the definition (the first one labeled with 1.).
So far, with the first thing that I tried I have come up with the following code...
@if (@CodeSection == @Batch) @then
set SendKeys=CScript //nologo //E:JScript "%~F0"
@echo off
findstr /m %word% dictionary.dic >nul
if %errorlevel%==0 (
%SendKeys% "t"
%SendKeys% ">%word% exists!"
%SendKeys% {ENTER}
ping localhost -n 4 >nul
goto home
)
%SendKeys% "t"
%SendKeys% ">%word% does not exist!"
%SendKeys% {ENTER}
ping localhost -n 4 >nul
goto home
)
@end
var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.SendKeys(WScript.Arguments(0));
...and yes, I need it to be %SendKeys%
not echo
. So as you can probably tell from the above code, all this does is search a list of all English words (a file that doesn't include definitions) and output if it exists or not, while what I need is it to output the definition.
As for my second idea, I have no idea where to start and have tried searching how to get variables from websites to no avail. So, I think the best bet is a file containing all accepted words and their definitions (eg. See below) and to use token
to get all tokens after the variable %word%
in the file.
abacus, an oblong frame with rows of wires or grooves along which beads are slid, used for calculating.
abhorrent, inspiring disgust and loathing; repugnant.
etc...
Thanks!