Jump to content

Help with simple workflow from selected text

Recommended Posts

As a medical student, I come up against a lot of words in my studies that I have no idea how to pronounce. Before Alfred, I would open Safari, go to www.howjsay.com and copy/paste the word into their search bar. With Alfred, I've been able to set up a custom howjsay search that includes that whole {query} replacement thing. I was wondering if there was a way to set up a workflow that makes use of currently selected text to do the same search on howjsay.


I thought that maybe instead of using {query} there would be a trigger for selected text, but I haven't been able to find anything.


Any thoughts?



Link to comment

Grabbing selected text from an arbitrary application doesn't work very well, as there isn't a universal method for doing so.

What you can do is trigger an AppleScript that will do a Copy for you:

tell application "System Events"
    keystroke "c" using command down
end tell
set theText to the clipboard as Unicode text

Now the selected text is on the clipboard. It's also in the theText variable if you want to process it further in AppleScript.

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...