TextEdit spelling/delete script

Hey
I was wondering how I would be able to make a script that would start the spelling checker (“Cmd :”) and go though each misspelled word and delete it.
Basically clicking ‘Find next’ then pressing delete, till it runs out of words.

Thanks.

I see that nobody’s bitten on this one yet. This is a dreadful kludge, but it works here:

set c to ASCII character 0
tell (ASCII character 8) to set d to it & it
tell application "System Events" to tell process "TextEdit"
	set frontmost to true
	keystroke (ASCII character 30)
	repeat
		set the clipboard to c
		keystroke ";c" using command down
		set t to (current date) + 2
		repeat while (the clipboard) is c and t > (current date)
		end repeat
		if (the clipboard) is c then exit repeat
		keystroke d
	end repeat
end tell

Of course, you may not want to nuke your clipboard. This version should restore it:

set c to ASCII character 0
tell (ASCII character 8) to set d to it & it
tell application "System Events" to tell process "TextEdit"
	set frontmost to true
	set s to the clipboard
	keystroke (ASCII character 30)
	repeat
		set the clipboard to c
		keystroke ";c" using command down
		set t to (current date) + 2
		repeat while (the clipboard) is c and t > (current date)
		end repeat
		if (the clipboard) is c then exit repeat
		keystroke d
	end repeat
	set the clipboard to s
end tell

:lol:
What exactly is a “kludge”?
Ferter: This seems like an odd request; how would you handle words identified as possibly misspelled words such as names, abbr., that are not misspelled, but unknown?
SC

http://en.wikipedia.org/wiki/Kludge

:slight_smile:

Thanks for the help, I’ll post a reply on how it works after my Exam …
The use of this script is to solve word problems where you are given letters and have to find words containing those letters.
I wrote a simple java program that out puts all the possible combinations of the x letters (in this case its 9), thankfully each letter can only be used once or the text file I dumb the ‘words’ into would be very large.
The script Kai wrote I hope will remove all the garbage Combinations of the letters. Heh I trust it works Kai :stuck_out_tongue:

This is a problem found in the newspaper … And since I was finding it impossible to complete with my own inadequate word knowledge … You know the rest :slight_smile:

Best regards
-Ferter