0

I use the Dictionary app many times when I'm reading a very old novel, and sometimes I write two words side by side without realising it (until I get no result), with that said, I need to tweak the Dictionary app so that it'd delete the word I've searched for after, say, 5 seconds of writing that word in the search box. Is it possible to do something like this?

Sorry for being verbose. Huge thanks in advance.

  • Just press the Esc key before typing in Dictionary, it will clear the Search text box. – user3439894 Aug 22 '18 at 19:11
  • @user3439894 That's one way, thanks for your suggestion :) – Yaman KJ Aug 22 '18 at 19:17
0

This works for me using the latest version of macOS High Sierra.

Save this following code in script editor as an application. This application will continue to run until you quit the Dictionary.app

Adjust the delay values to suit your needs.

tell application "Dictionary" to activate
delay 1
repeat until application "Dictionary" is not running
    tell application "System Events"
        tell process "Dictionary"
            tell its window 1
                repeat
                    delay 1
                    try
                        if value of text field 1 of group 3 of toolbar 1 is not "" then
                            delay 5
                            try
                                set value of text field 1 of group 3 of toolbar 1 to ""
                            end try
                        end if
                    end try
                    exit repeat -- when you want to exit the loop
                end repeat
            end tell
        end tell
    end tell
end repeat

Be sure to add this new created application to your list of apps allowed to control your computer.

enter image description here

  • 1
    Exactly what I needed! Thank you so much, this is really helpful! (How can I learn to write scripts like this one?) – Yaman KJ Aug 23 '18 at 19:15
  • @YamanKJ You can learn the way most of us do…, Read read read, Practice practice practice, trial and error trial and error trial and error LOL – wch1zpink Aug 23 '18 at 19:33
  • But is there a dummy guide or something for using Script Editor? I'd like to take this much further indeed. – Yaman KJ Aug 23 '18 at 20:23
  • For learning purposes, this has been my number one tool... allitebooks.com/learn-applescript-3rd-edition – wch1zpink Aug 23 '18 at 21:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .