Re: Changing Spelling Dictionary?
Re: Changing Spelling Dictionary?
- Subject: Re: Changing Spelling Dictionary?
- From: Harald E Brandt <email@hidden>
- Date: Wed, 21 Apr 2004 10:04:57 +0200
On 2004-04-20, at 11.16, Walter Ian Kaye wrote:
And if anyone wants to _disable_ the interactive spell checking:
defaults write -g CheckSpellingWhileTyping 0
That's not very effective!
One has to restart the app before it takes effect in that app! And with
some apps, such as Hog Bay Notebook, it has no effect at all!
A much better way to do it is via UI scripting. Below, I paste a script
that will toggle the setting in the app you are currently using (it is
local to the app). Put the script in "<your home
folder>:Library:Scripts:", then use a key binding utility such as iKey
to bind a key combo to it. (It assumes an English system, so maybe you
need to adapt this script to fit the language of your OS.)
------------------------
tell application "Finder" to set x to get displayed name of (path to
frontmost application)
tell application "System Events"
set frontmost of process x to true
tell process x
try
click menu item "Check Spelling as You Type" of menu "Spelling" of
menu item "Spelling" of menu "Edit" of menu bar 1
on error
beep
return false
end try
end tell
end tell
------------------------
At 05:59p +0900 04/20/2004, email@hidden didst inscribe upon
an electronic papyrus:
i hope you make it. if you do your script is going to be used all
over the world !
I updated the script I posted a couple of days ago that would switch
dictionaries. I discovered one app (Hog Bay Notebook) that had three
dots instead of an ellipsis. This script also tries to remember the
last used dictionary and change to the other one, but it is only a
"guess" since it is local to an app. It is possible to make an
elaborate property list handling that remembers settings in various
applications -- Deivy made such a script and he might publish it here.
It is never going to be fully robust and general though, so I think the
script below is good enough, and in any case, you don't have to use the
mouse -- just use the arrow key (if needed) and hit return. As with the
script above, put it in your Scripts folder, bind a key combo to it
with some utility. (And of course, also this script may need to be
adapted to fit the language of your OS.)
------------------------
property mnu : "English"
tell application "Finder" to set x to get displayed name of (path to
frontmost application)
set lista to {"English", "Svenska"} --<== just include the languages of
choice here (or make sure to learn some Swedish:-)
if mnu = item 1 of lista then
set mnu to item 2 of lista
else
set mnu to item 1 of lista
end if
tell application x to choose from list lista with prompt "Pick
dictionary:" default items {mnu} without multiple selections allowed
--the 'tell app' is there only to ensure it is targeted the right app
in case the script is run from e.g iKey, which otherwise would target
Finder.
if result is not false then
set mnu to item 1 of result
tell application "System Events"
set frontmost of process x to true
tell process x
try
try --most apps use ellipsis after "Spelling": NOTE!!! THIS LIST
WILL MANGLE THE ELLIPSIS! ENTER THE RIGHT CHARACTER!
click menu item "Spelling" of menu "Spelling" of menu item
"Spelling" of menu "Edit" of menu bar 1
on error --but at least Hog Bay Notebook uses three dots:
click menu item "Spelling..." of menu "Spelling" of menu item
"Spelling" of menu "Edit" of menu bar 1
end try
tell window "Spelling"
click pop up button 1 of group 1
tell menu "OtherViews" of pop up button 1 of group 1 to click menu
item mnu
click button "Button" --closes the spelling window
end tell
on error
beep
return false
end try
end tell
end tell
end if
------------------------
____heb____________________
Harald E Brandt
http://bragit.com
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.