• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Scripting the macOS Spelling Dictionary
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scripting the macOS Spelling Dictionary


  • Subject: Re: Scripting the macOS Spelling Dictionary
  • From: Shane Stanley <email@hidden>
  • Date: Sun, 22 Jan 2017 14:05:17 +1100

On 22 Jan 2017, at 1:43 pm, Christopher Stone <email@hidden> wrote:

Has anyone come up with a means to script adding words to the macOS dictionary in a way the system recognizes without logging-out and back in again?

use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use framework "AppKit" -- for NSSpellChecker
use scripting additions

set theWord to "zzounds"
set theChecker to current application's NSSpellChecker's sharedSpellChecker()
theChecker's learnWord:theWord
set knewIt to theChecker's hasLearnedWord:theWord
theChecker's unlearnWord:theWord
set knowsItNow to theChecker's hasLearnedWord:theWord
return {knewIt, knowsItNow}

-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Scripting the macOS Spelling Dictionary
      • From: Christopher Stone <email@hidden>
References: 
 >Scripting the macOS Spelling Dictionary (From: Christopher Stone <email@hidden>)

  • Prev by Date: Scripting the macOS Spelling Dictionary
  • Next by Date: Re: Illustrator scripting
  • Previous by thread: Scripting the macOS Spelling Dictionary
  • Next by thread: Re: Scripting the macOS Spelling Dictionary
  • Index(es):
    • Date
    • Thread