LookupWord - From Mac

less than 1 minute read

Save the word when using Mac to look up

preparation

  1. Server side set up
  2. Applescript

This one is extremely easy, only one step, which is use Automator to create a service, and set up a shortcut.

here is the script you need to use, replace [your app's url] to yours, and copy it.

on run {input, parameters}
	
	set lookUpWord to quoted form of (input as string)
	--This sets the word to the selected text, from input.
	
	do shell script "open dict://" & lookUpWord
	--This opens the word in Dictionary.
	
	do shell script "curl https://[your app's url]/word/" & lookUpWord
	
	return input
end run

Then open Automator, and create a new service

create applescript

After you’ve set up service, you just need to access it with shortcut, so go to System preferences/keyboard/shortcut to set it up.

add shortcut

Then, done!!

You can now select a word a use the short to search.

and you can check it from the server you’ve made.

Looking forward to build the iOS client to use the data in the next tutorial.

see ya.