I have a long TextEdit document I frequently open (via a keystroke, thanks to Alfred). It contains many non-standard spellings, so I de-select "Check Spelling While Typing" (though I want spell checking to be default on with other TextEdit documents). Note that I've created the shortcut "Command/Option/Control - S" (in Prefs/Keyboard/Shortcuts) to toggle that command.
To save myself a step, I want to create an applescript to open the document and trigger that command. But I just can't make it work.
The document opens, but "Check Spelling While Typing" won't toggle off.
tell application "Finder"
activate
open document file "reference.rtf" of folder "Documents" of folder "MYSTUFF" of folder "Users" of startup disk
end tell
tell application "TextEdit" to activate
tell application "System Events"
keystroke "s" using {command down, option down, control down}
end tell
==============
EDIT:
I've inserted "Delay", but that doesn't help; the spellings are highlighted.
Is it possible Applescripts for some reason can't invoke custom shortcuts within applications (that have been rigged up via Prefs/Keyboard/Shortcuts)?
Is there another way to invoke the "Check Spelling While Typing" command? It doesn't seem to be one of TextEdit's scriptable commands.
delay 1
between the activate and the keystroke line? (causes a 1 second delay, increase/decrease the number if necessary)