MacOS Dictionaries and Shortcuts for Jisho.org, OCR, Audio Recording, and Screenshots

Mathew Chan
8 min readMay 31, 2021

--

Photo by Tianyi Ma on Unsplash

Do you need to…

  • get a popup dictionary on Mac?
  • record audio and take screenshots with ShareX to build your sentence cards in Anki?
  • OCR text on a screen selection like Capture2Text?

You can do these on your Mac without external programs.

Welcome to MacOS and everything that’s already on your machine.

Welcome to MacOS

With the introduction of affordable yet insanely capable M1 Macbooks and iMacs, there has been an influx of people who decided to make the switch to MacOS. Many of these new users are also language leaners who are looking for guides to set up a language learning environment, only to find out most of these tools are only available on Windows.

Where is [freeware.exe] for Mac?

This is a common question and it exists for a good reason. While most commercial apps are available on every platform nowadays, many legacy apps were distributed only on Windows and there are no comparable free alternatives on MacOS. This is not simply because there were less Mac users in the past. Nor is it simply the fact that Apple customers are more willing to pay for apps.

Despite what some might think of Apple software as a walled ecosystem, MacOS actually makes scripting and automating tasks super easy with Automator, an app that allows users to perform simple tasks without any programming knowledge, while being fully extensible with AppleScript, Bash, JavaScript, Python or any other programming language.

A primary reason is that you can already perform a lot of these tasks with built-in tools and simple scripts.

Here are 7 tools and scripts made just for language learners.

Look up a word in Spotlight

Press Command+Space to launch spotlight and enter the word to look up. You can immediately get the Japanese or English definition as well as example sentences.

To activate Japanese dictionaries on your Mac, launch the Dictionary app (by typing command+space for Spotlight and typing in Dictionary) and on the top left corner click Dictionary > Preferences.

You can reorder these dictionaries to either show the Japanese definition or English definition as the first result. By default you get the J-E dictionary The Wisdom English-Japanese Dictionary and the J-J dictionary スーパー大辞林.

MacOS Popup Dictionary

MacOS comes preinstalled with a popup dictionary that can be accessed with force touch, three finger touch, or right click > Look up word.

Unlike browser popup dictionaries like Yomichan and Rikakun that only works in browsers, this popup dictionary works on all native apps and almost every desktop app.

MacOS’s popup dictionary works with almost any desktop app

(You might need to activate this feature in System Settings > Touchpad)

Add Jisho, Weblio and other online dictionaries

You can easily add Jisho, Weblio, or other online dictionaries as a Service.

Jisho as a Service

Launch Automator by pressing Command⌘+Space for Spotlight and typing in automator, and hitting Enter.

Create a Quick Action.

Select receives current text for Workflow.

Add a Run Javascript action by searching for javascript in the upper left search bar and double clicking the Run Javascript item.

Replace the line “ // Your script goes here” with this line of code:

input[0] = 'https://jisho.org/search/' + input[0];

Or use this line of code for Weblio:

input[0] = 'https://ejje.weblio.jp/content/' + input[0];

Add a Website Pop-up action and choose your browser (User-agent) and window size (Site-size). I prefer iPhone so the popup window doesn’t take over my screen.

Creating a custom service for selected text in Automator

Press Command+ S and save the quick action as Jisho.

Now back in your browser or any other app, select a word and right click Services > Jisho.

Close the dictionary window by pressing the key Esc.

Text to Speech in Japanese

To enable text to speech in Japanese, you have to configure a Japanese system voice.

In System Preferences > Accessibility > Speech, click System Voice and select Customize.

Scroll down to select Japanese (Japan) voices. It might take a few minutes to install these voices. After hitting OK, switch the system voice to the newly installed voice.

Whenever you right click on a text selection, select Speech > Start Speaking to hear the word being said.

Note that the voice is synthetic and if you prefer natural voice you can use online services like Jisho or Forvo.

OCR to Clipboard

This script enables you to extract text from visual media like games, manga, and illustrations and copies the result to your clipboard so you can quickly look them up through spotlight dictionary, clipboard inserter to look them up through Yomichan, or apps like Game2Text to facilitate your flashcard creation workflow.

extracting text to clipboard inserter for dicitonary lookup

It’s a few lines of code on your Mac that does basically what Capture2Text does

First, we need to install the OCR engine Tesseract through Homebrew:

brew install tesseract
brew install tesseract-lang

In Automator, create a new Quick Action and add Run AppleScript and paste the following script.

Press Command⌘+S and name the action as Capture2Clipboard.

Then go to System Preferences > Keyboard > Shortcuts. Select Services from the sidebar and find the service Capture2Clipboard. Add a shortcut by double clicking (none).

I’m using the hotkey Command+Control+O (^⌘O). Command+Control+A-Z are usually available for your custom global shortcuts, with Command+Control+F being a notable exception.

You might also need to go to System Preferences > Security > Privacy > Accessibility and give Automator permission to read keystrokes. This is not required on my Mac running Catalina 10.15.7.

Whenever you press the hotkey, you can select a region to extract text and the result will go to your clipboard.

Audio to Clipboard

This script enables you to to record audio and have the result in your clipboard so you can directly paste it to Anki or a custom folder.

This is really helpful when creating Anki cards with audio data. This setup will take a few more steps, involving creating an Application with AppleScript and invoking it with a Quick Action.

In Automator, create a new Application.

Add a Run AppleScript action by searching for applescript in the upper left search bar and double clicking the Run AppleScript item.

Paste the following script to the action.

Press Command+S and name the application as Audio To Clipboard.

AppleScript Application

In Automator, create a new Quick Action and add Launch Application and select the newly created Audio To Clipboard.app located in ~/Library/Services folder.

Hit Command+S and name it as Voice To Clipboard.

Type in the file name in the top right Search bar if you’re having trouble locating the application

Then go to System Preferences > Keyboard > Shortcuts. Select Services from the sidebar and find the service Voice To Clipboard. Add a shortcut by double clicking (none).

I’m using the hotkey Command+Control+V (^⌘V).

When you run the script for the first time through the keyboard shortcut, you may need to give Accessibility permission to Audio To Clipboard.

Once permission is given, you can type in the shortcut (^⌘V) anywhere on your Mac to record audio and press Command+V to directly paste it to the Anki Audio field.

To record sound going through your browser on Netflix or in a game, you would also need to set up a Virtual Audio Cable.

Recording System Audio through BlackHole

Blackhole — a modern Virtual Audio Cable for MacOS

Install BlackHole, a virtual audio cable to pass system sound as a microphone.

If you have brew installed, you can just type the following command to Terminal.

brew install blackhole-16c

Once installed, we can set audio passthrough.

Launch Auto MIDI Setup by pressing command+space for Spotlight, typing in midi and pressing enter.

In Auto MIDI Setup, click on + icon in the bottom left corner and add a new Multi-Output Device. In the list of devices, click on the BlackHole 16ch checkbox and also the checkboxes for your speakers or headphone.

Type command-space to launch Spotlight again and type in sound to launch Sound Settings.

On the Output tab, select Multi-Output Device and on the Input tab select BlackHole 16ch.

Output settings: Multi-Output Device
Input Settings: BlackHole 16ch

System sound coming from your browser or your game will now become the default microphone source.

Capturing Screenshots to Clipboard on Mac

You may already know these two screenshot shortcuts.

  • Shift ⇧ + Command ⌘ + 4: screen captures selection
  • Shift ⇧ + Command ⌘ + 4 + Space: screen captures application

By pressing Ctrl at the same time while pressing the shortcuts, the image will be copied to your clipboard instead of being saved to your desktop.

Then you can directly paste it to an image field in Anki or to another folder in Finder.

You may also find it handy to remove the default shadows applied to the screen capture image by holding option after you press the shortcut but before you click on the application window.

Wrapping it up

We’ve just demonstrated how you can do many common tasks for language learning with a few scripts and shortcuts.

There is much more to add and customize. Here are some ideas:

  • Extend OCR selection to automatically create an Anki note through AnkiConnect
  • Extend Voice Memo shortcut to automatically create an Anki note with the audio recording and the screenshot of a particular application.

Let me know if this was helpful.

--

--