tags:

views:

36

answers:

1

in google, you can do "define:cat" and it will give you a list of definitions.

Does anyone know how to get the definitions of a word with applescript from google?

Thanks!

+1  A: 

Rough and tumble, but it works...

tell application "Safari"
    make new document with properties {URL:"http://www.google.com/search?q=define%3Acat"}
    set theDocument to document 1
    set theSource to source of theDocument -- result: source code for the page.
end tell

Note that the search term can be tacked onto the end after the delimiter %3A. From there, you'll have to scrape what you want from the page, but that's icky in even the best of languages.

Philip Regan
Oh ok. For some reason it's not giving me the correct source. It says in the source that's the page is forbidden. Weird. Happens when I curl it too. Any ideas?
Elijah W.