Applescript to get a word meaning

Hi,
I’m a total newbie at apple-scripting. Was trying my luck at making a plugin for salling clicker which would take a word from the mobile - search for its meaning using apple’s dictionary and then send the meaning back to the mobile.

Got stuck in trying to get the meaning from the dictionary. I know it can be done using the dictionary service - but how is the question.
Apple support pages say that directory services can be used using the functions mentioned in this page:

http://developer.apple.com/documentation/UserExperience/Reference/DictionaryServicesRef/Reference/reference.html#//apple_ref/c/func/DCSGetTermRangeInString

However cannot understand head or tail of using this.

Someone please help.

Regards,
Dushyant

See this thread:
http://bbs.macscripter.net/viewtopic.php?id=20131

doesn’t work for me unfortunately - I get errors in all the scripts :frowning:

For GUI scripting you have to check “Enable access for assistive devices” in System Preferences > Universal Access
otherwise you get a “NSReceiverEvaluationScriptError: 4” error

Hi dushu,

the Dictionary Services are a great new feature of Mac OS X 10.5 Leopard and it is not very hard to access this excellent framework. All you need is a small Python helper script that I wrote for you to get you started. Just download it to your desktop and then execute the following AppleScript code:


set searchword to "Steve Jobs"
set pyscriptpath to quoted form of (POSIX path of (((path to desktop) as Unicode text) & "dict.py"))
set command to "/usr/bin/python " & pyscriptpath & " " & quoted form of searchword
set dictresult to (do shell script command)

Please note that you need Mac OS X 10.5 Leopard to test this.

Thanks a lot - thats just perfect for me. :smiley: