[TxMt] Lookup current word in Dictionary.app

Oliver Taylor oliver at ollieman.net
Mon Nov 6 22:49:02 UTC 2006


I haven't run across this before, so I thought I'd share.



Here's a simple command for looking up the current word in  
Dictionary.app:

osascript &>/dev/null \
-e 'with timeout of 30 seconds' \
-e 'tell application "Dictionary"' \
-e 'activate' \
-e 'end tell' \
-e 'end timeout' \
-e 'do shell script "open dict:///$TM_CURRENT_WORD"' &

We can't just do the shell script because, for whatever reason, it  
only works if Dictionary.app is already open. Without the "Timeout"  
argument applescript will not wait for Dictionary.app to open before  
requesting the definition.

I'm sure there are better ways to code this, but it works for me.

--oliver
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2421 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20061106/e1f04239/attachment.p7s>


More information about the textmate mailing list