Mailsmith
Other Programs
Scripts
Mailsmith.scpt
Archive to sub-mailbox
Check Spelling
Find reply
Change font size
Submit Script to JEM
Fix common spelling errors
Setting SMTP server
URL from Safari
Address from AB
linkMunge
Export to Address Book
Saving attachments
Digest Script
File with same
POP window position
Position of new windows
iCal and Mailsmith
Edit From Line
Modified Thread Script
Reply to Selection
Temporary Text Window
Compact gain
Tracking backups
Edit subject
Googler
Auto-rewrap
MMA
SMTP server
Open, fetch, and close
URL Manager
BrainForest
Thread by Author
Thread by subject
Export Email
Get Selection
Read Addresses
Export Email
Organize Email
Account setup
Mailsmith 2 BBEdit
BBEdit 2 Mailsmith
Search II
Check One
Delete Enclosure
Open, fetch, close
Set Answered
Set Redirected
Empty Trash
List found
Print Several
Del. old. msg.
Delete Enclosures
Accounts
Address Book
Editing
Filters
General
Import/Export
Links
Mailboxes
Memory
Scripting
Speed
send/receive
Tips/Tricks


Check Spelling

Author Charlie Garrison
Last modified 2003-05-15
What is this?

This is a script to move the insertion point to the beginning of the message before starting spell check.

Under certain circumstances the 'Start At Top' setting of the Check Spelling dialog gets switched off. I don't always notice and end up only spell checking the end of my message (usually nothing but my name). This script will first record the current selection, then move the insertion point to the beginning of the message. After the spell check is complete, the script will reset the original selection.

If the selection is more than zero characters, then the script does not change the selection, in order to enable the 'Selection Only' option the Check Spelling dialog. The script will beep in this case, giving you a warning that you may want to unselect text first.

One side effect of this script is that the selection will revert back even if misspelled words were found. Usually the last misspelled word would be selected after doing a spell check.

Note: the name of the script needs to match menu and menu item spelling exactly. The 'Check Spelling…' item name ends with an ellipses, not three periods. The ellipses is created by typing opt-; (option semi-colon).


(*
Text•Check Spelling…  (attached menu script)
Written by Charlie Garrison - 15/05/2003
garrison@zeta.org.au   http://www.garrison.com.au/

This is a script to move the insertion point to the beginning of the message
before
starting spell check.
*)
property currSel : null
property selChanged : false

on menuselect(menuName, itemName)
    --display dialog menuselect: " & menuName & " item: " & itemName buttons {"OK"} default button 1
    if menuName is equal to "Text" and itemName is equal to "Check Spelling…" then
        set weHandledCommand to false -- let Mailsmith process command 
        set selChanged to false -- don't change selection on postmenuselect 
        tell application "Mailsmith"
            if class of front window is message window then
                set currSel to selection of front window
                if length of currSel = 0 then
                    select insertion point before character 1 of front window
                    set selChanged to true
                else
                    beep -- selection is > 0, will do 'selection only' spell check
                    --set weHandledCommand to true 
                        -- postmenuselect never gets called and Mailsmith doesn't handle command
                end if
            end if
        end tell
        return weHandledCommand
    end if
end menuselect

on postmenuselect(menuName, itemName) -- called after Mailsmith has processed
the command
    --display dialog "postmenu: " & menuName & " item: " & itemName buttons {"OK"} default button 1
    if selChanged then
        select currSel
        set selChanged to false
    end if
    --beep
end postmenuselect