| View previous topic :: View next topic |
| Author |
Message |
Diamond
Joined: 31 Mar 2006 Posts: 127 Location: New York
|
Posted: Thu Sep 14, 2006 9:26 am Post subject: Script for All-Purpose Spell Checker |
|
|
Thanks MsgBox, this
http://www.autohotkey.com/forum/viewtopic.php?t=12584&highlight=spell+checker
was a good idea, so I stole it. However, since I'm visually impaired and I rely on screen reading software, I needed something with a windows GUI. This script is for All-Purpose Spell Checker.
http://www.math.mcgill.ca/rags/apscinst.exe
This should work on either selected text or the entire document otherwise.
| Code: | ;Spell Check with APSC
Break::
WinGet ID, ID, A
CS = %ClipboardAll%
Clipboard =
SendInput ^c
ClipWait 0.1
If Clipboard =
{
SendInput ^a
SendInput ^c
ClipWait
}
PRTXT = %Clipboard%
Process Exist, APSC.exe
APSCPID = %ErrorLevel%
If APSCPID = 0
{
Run C:\Program Files\Palware\APSC 4.0\APSC.exe,,, APSCPID
WinWaitActive ahk_class ThunderRT5Form ahk_pid %APSCPID%
}
Else
{
WinShow ahk_class ThunderRT5Form ahk_pid %APSCPID%
WinActivate ahk_class ThunderRT5Form ahk_pid %APSCPID%
WinWaitActive ahk_class ThunderRT5Form ahk_pid %APSCPID%
}
Loop
{
ControlFocus RichTextWndClass1, ahk_class ThunderRT5Form ahk_pid %APSCPID%
ControlGetFocus Focus, ahk_class ThunderRT5Form ahk_pid %APSCPID%
If Focus = RichTextWndClass1
Break
}
Sleep 100
SendInput ^v
ControlGetPos XPos, YPos,,, ThunderRT5PictureBox1, ahk_class ThunderRT5Form ahk_pid %APSCPID%
Click %XPos%, %YPos%
WinWaitActive Misspelled Word Found ahk_class #32770 ahk_pid %APSCPID%,, 1
If ErrorLevel = 1
{
MsgBox 64, All-Purpose Spell Checker, No misspelled words found.
WinClose ahk_class ThunderRT5Form ahk_pid %APSCPID%
WinActivate ahk_id %ID%
Clipboard = %CS%
CS =
Focus =
PRTXT =
ID =
APSCPID =
Return
}
WinWaitClose Misspelled Word Found ahk_class #32770 ahk_pid %APSCPID%
Loop
{
ControlGetFocus Focus, ahk_class ThunderRT5Form ahk_pid %APSCPID%
If Focus = RichTextWndClass1
Break
}
Clipboard =
SendInput ^s
ClipWait
WinClose ahk_class ThunderRT5Form ahk_pid %APSCPID%
WinActivate ahk_id %ID%
If (PRTXT != Clipboard)
{
WinWaitActive ahk_id %ID%
SendInput ^v
Sleep 100
}
Clipboard = %CS%
CS =
Focus =
PRTXT =
ID =
APSCPID =
Return |
The built-in hotkey Ctrl+k activates the spell checking once you've copied the text into the program, but there seems to be a strange bug which somehow replaces the first occurrence of a misspelled word with the "k" from this key combination. This is why I use the "ControlGetPos" and "Click" lines instead.
Last edited by Diamond on Sat Jun 02, 2007 10:30 am; edited 12 times in total |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3841 Location: Bremen, Germany
|
Posted: Thu Sep 14, 2006 9:39 am Post subject: |
|
|
Dear Diamond,
I moved your script into the script section.
Thanks for sharing. _________________ Ciao
toralf  |
|
| Back to top |
|
 |
Diamond
Joined: 31 Mar 2006 Posts: 127 Location: New York
|
Posted: Sat Sep 16, 2006 4:41 pm Post subject: |
|
|
| A couple of small fixes. |
|
| Back to top |
|
 |
slomz
Joined: 03 Sep 2006 Posts: 608 Location: Iowa, U.S.
|
Posted: Sat Sep 16, 2006 7:37 pm Post subject: |
|
|
| Very nice script. |
|
| Back to top |
|
 |
Diamond
Joined: 31 Mar 2006 Posts: 127 Location: New York
|
Posted: Tue Sep 19, 2006 4:08 am Post subject: |
|
|
| The previous method for activating the spell check dialog wasn't working consistently enough. Hopefully this will work better, but we shall see. |
|
| Back to top |
|
 |
Diamond
Joined: 31 Mar 2006 Posts: 127 Location: New York
|
Posted: Wed Oct 25, 2006 7:59 pm Post subject: |
|
|
| Some small changes. |
|
| Back to top |
|
 |
Diamond
Joined: 31 Mar 2006 Posts: 127 Location: New York
|
Posted: Thu May 31, 2007 1:27 am Post subject: |
|
|
Some minor changes.
I also added "SetTitleMatchMode 3" to the script because it doesn't seem to work correctly when you have TitleMatchMode set globally to RegEx. I'm not quite sure why. |
|
| Back to top |
|
 |
Diamond
Joined: 31 Mar 2006 Posts: 127 Location: New York
|
Posted: Sat Jun 02, 2007 10:19 am Post subject: |
|
|
| The script now uses the active window's ID instead of the cumbersome Title/Class/PID method I was previously using. This also eliminates the need for "SetTitleMatchMode". |
|
| Back to top |
|
 |
|