It's not neat, and it ain't pretty but it seems to work
NOTE: Search and replace for au3speller (filename) as it can trigger a simple self test.
AutoIt
; FILENAME: au3Speller.au3 ; PURPOSE: Create a dead simple spell checker using ASpell. ; RESOURCES: http://aspell.net/win32/ ; CODEPLAN ; [b]Installation:[/b] ; TODO: The entire installation is manual at the moment. I got the full installer from ; http://aspell.net/win32/ And the language files I needed. ; I Installed the files. Copied the installation directory to a temporary area ; Trimmed it down somewhat (removed readme, docs, and such. ; Then I uninstalled the installed files. ; Pointed the variable $dirASpell to my modified Aspell folder. ; ; NOTE: I have not made a config thing around this to be able to select other dictionary's ; ; TODO: Create installer routine: ; Check for Aspell in this directory If it does not exists check ; if the ASPELL environment variables are set. If nether are available ; Let the user decide if he wants do download the stock version or ; a version (English) prepared by me and placed on a free-downloads server. ; ; [b]Usage:[/b] ; 1: Create a temporary file from the content on the clipboard ; 2: Check it ; 3: Replace clipboard content with the checked file. ; 4: Remove the file. ; #region - au3wrapper settings #compiler_compression = 4 #compiler_OutFile_Type=exe #compiler_run_after=move "%out%" c:\au3tools #compiler_run_after=c:\au3tools\%scriptfile%.a3x ;#compiler_run_after=del /F %out% ;NOTE: This is a include file! So delete "executable" if test compiled! #endregion #include-once #include <File.au3> If StringInStr(@ScriptName, "au3Speller") Then If NOT @Compiled Then ;Create some test data ClipPut("thi is just a smalller test fil to see if it woks") ; "this is just a Small test file to see if it works" EndIf Local $inifile = @ScriptDir & "\" & StringLeft(@ScriptName, StringLen(@ScriptName) - 4) & ".ini" Local $command = IniRead($inifile, "settings", "command", "check") Local $dirASpell = IniRead($inifile, "settings", "diraspell",@ProgramFilesDir & "\ASpell" ) ;Default installation location If NOT FileExists($dirASpell) Then Local $foo = FileOpenDialog("Select ASpell directory:", $dirASpell, "All(*.*)", 2, 'select dir') $dirASpell = StringReplace($foo, 'select dir', '') FileDelete($inifile) EndIf If not FileExists($inifile) Then ConsoleWrite('!Writing ini: ' & $inifile & @LF) IniWrite($inifile, "settings", "command", $command) IniWrite($inifile, "settings", "diraspell", $dirASpell) Run("notepad.exe " & $inifile) EndIf ASpellClipboard($command, $dirASpell) Exit Else ConsoleWrite("au3Speller.au3 used as include file" & @LF) EndIf ; Func ASpellClipboard($command = "check", $dirASpell = "..\ASpell\", $exeASpell = "\bin\aspell.exe", $file = "") ;TODO: Set corect folder Local $clipPut = False If Not FileExists($exeASpell) Then If FileExists($dirASpell & "\" & $exeASpell) Then $exeAspell = $dirASpell & "\bin\aspell.exe" Else MsgBox(16, "ERROR " & @ScriptName & "::" & "RunASpell", "Could not locate: " & $dirASpell & "\" & $exeAspell) Return 0 EndIf EndIf $command = '--prefix="' & $dirASpell & '" ' & $command If $file = "" Then ConsoleWrite('+>DBG: Use clipboard content' & @LF) $filename = _TempFile() FileWrite($filename,ClipGet()) $clipPut = True EndIf ;TODO: This is not optimal usage as RunWait will disable the shell from other operations. ; This is a typical place where a thread would be a better aproache ConsoleWrite('RunWait(' & $exeAspell & " " & $command &" " & $filename & ')' & @LF) RunWait($exeAspell & " " & $command & " " & $filename) ConsoleWrite('@error:=' & @error & ', @extended:=' & @extended & @LF) If $clipPut Then ConsoleWrite('+>DBG: Replace clipboard content' & @LF) ClipPut(FileRead($filename)) FileDelete($filename) endIf Return 1 EndFunc





