Jump to content

Not working: Define selected text in Dictionary


Recommended Posts

Thanks @Ritashugisha, unfortunately I couldn't make it work either. Basically I want to create a script that diplays the OSX Thesaurus for the selected text. Trying to get the Dictionary to open is just the first step.

Link to comment

Thanks @Ritashugisha, unfortunately I couldn't make it work either. Basically I want to create a script that diplays the OSX Thesaurus for the selected text. Trying to get the Dictionary to open is just the first step.

 

See if this script will work for you:

tell application "Dictionary"
	activate
end tell
open location "dict://" & "{query}"
tell application "System Events"
	tell process "Dictionary"
		tell menu bar 1
			tell menu bar item "Search"
				tell menu "Search"
					click menu item "Oxford American Writer's Thesaurus"
				end tell
			end tell
		end tell
	end tell
end tell

Link to comment

On Mavericks, the "all" tab that is open immediately helps. You could actually just use the URI scheme by running it as a bash script that uses the command:

 

"open dict://{query}"

 

Or you could use the "run command in terminal" action. Either way, it's pretty simple.

Link to comment

This is funny: I open Alfred2 in order to make a quick example for a more elegant way for you to do this, and I realized that I had been writing something similar several months ago and hadn't finished it. Well, mine was querying the dictionary file itself with a python library, but if I ever finish it, then I'll post that, but, here's is a more elegant solution for you:

 

dict.png

 

 

As you can see, you can run terminal commands just as a "bash script"

 

So, this workflow just consists of a keyword that links to a bash script with only one line:

open dict://{query}

And that should do it.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...