AppleScript Question

Sarah Reichelt sarah.reichelt at gmail.com
Fri Jul 14 18:03:41 EDT 2006


> I'm trying to get the Dictionary.app to cooperate with my project,
> but can't figure out how to do what I need.
>
> What I want to do is when you highlight a word in a a field, right
> click and select a menu entry, to send that word to the
> Dictionary.app so that it will look up the word.
>
> No problem on the highlight, right click and menu stuff, but getting
> the Dictionary.app to open and look up the word is the problem.
>
> I checked Apple's site to see if Dictionary.app was scriptable, but
> it's not.  But!  It says that if you type into Safari Dict:///word
> (word being the word you want to lookup) that Safari will open the
> Dictionary.app program and have the Dictionary.app lookup the word.
>
> So I tried using revGoURL, which opened Safari, and Dict:///word was
> sent to Safari, but Safari added http:// in front of Dict:///word,
> which of course did nothing.
>
> I thought that I'd try to see if there was an AppleScript solution to
> this using the Dict:///word idea, but my knowledge of AppleScript is
> nill and my attempts so far have done nothing at all.
>
> Does anyone have any suggestions, ideas or maybe even some code that
> might accomplish what I need for this?  Something maybe that opens
> Safari hidden, send the data to it without it getting http:// stuffed
> in front of it?

There is an AppleScript scripting addition called XSpell that provides
AppleScript commands for checking spelling but that doesn't help if
you want the definitions.

I would check out the Dictionary Dashboard widget (open the widget's
package and browse through the files there). You may find it uses
shell commands or something that you can modify for your purposes.

Alternatively, what happens if instead of revGoURL, you use load URL
"dict:///...."? If you can get the data directly that way, it would
probably be the best solution.

Cheers,
Sarah



More information about the use-livecode mailing list