Jump to content

Search the Community

Showing results for tags 'aspell'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Hello, I am trying to create a Spell Checker with help of Aspell.exe, my intention is to communicate with Aspell.exe through _NamedPipes_CreatePipe , after reading the following articles & discussions: http://aspell.net/man-html/Through-A-Pipe.html https://www.autoitscript.com/forum/topic/120575-createprocess-with-stdio-solved/ https://msdn.microsoft.com/en-us/library/windows/desktop/ms682499(v=vs.85).aspx I wrote this script: #include <AutoItConstants.au3> #include <WinAPI.au3> #include <NamedPipes.au3> Global $hOutRead, $hOutWrite, $hInRead, $hInWrite Global $hSTD_OUT_ReadPipe, $hSTD_OUT_WritePipe Global $hSTD_IN_ReadPipe, $hSTD_IN_WritePipe $iPID = _Run("C:\Program Files (x86)\Aspell\bin\aspell.exe", " -a", "C:\Program Files (x86)\Aspell\bin") ConsoleWrite("pid:" & $iPID & @LF) ;read 1st msg _ReadMsg() ; try to check spell Local $iData,$nBytes,$tBuffer $iData = "Thq Quick Brown Fox Jumps ovzr tha lezy dog." $tBuffer = DllStructCreate("byte["&StringLen($iData)&"]") $res = _WinAPI_WriteFile($hSTD_IN_WritePipe, DllStructGetPtr($tBuffer), StringLen($iData), $nBytes) ConsoleWrite(">WriteResult:"&$res&":"&$nBytes&@LF) ; totally stuck _ReadMsg() _WinAPI_CloseHandle($hSTD_OUT_ReadPipe) Exit Func _ReadMsg() Local $tBuffer,$nBytes,$rData,$return While True ToolTip("i am stuck") $tBuffer = DllStructCreate("byte[4096]") $sOutput = _WinAPI_ReadFile($hSTD_OUT_ReadPipe, DllStructGetPtr($tBuffer), 4096, $nBytes,0) If $nBytes > 0 Then ; Exit the loop if the process closes or StdoutRead returns an error. $rData = BinaryToString(DllStructGetData($tBuffer, 1)) ConsoleWrite($rData) If StringInStr($rData, @LF) Then ConsoleWrite("msg complete" & @LF) ToolTip("") ExitLoop Else $return = $rData EndIf $tBuffer = 0 $nBytes = 0 Else ExitLoop EndIf WEnd ;-------------- Return $return EndFunc ;==>_ReadMsg Func _Run($location, $sCmd, $sWorkingDir = "", $state = @SW_SHOW) Local $tProcess, $tSecurity, $tStartup Local Const $STARTF_USESHOWWINDOW = 0x1 Local Const $STARTF_USESTDHANDLES = 0x100 ; Set up security attributes $tSecurity = DllStructCreate($tagSECURITY_ATTRIBUTES) DllStructSetData($tSecurity, "Length", DllStructGetSize($tSecurity)) DllStructSetData($tSecurity, "InheritHandle", True) DllStructSetData($tSecurity, "Descriptor", Null) ; Create a pipe for the child process's STDOUT ;************** _NamedPipes_CreatePipe($hSTD_OUT_ReadPipe, $hSTD_OUT_WritePipe,DllStructGetPtr($tSecurity)) _WinAPI_SetHandleInformation($hSTD_OUT_ReadPipe, 1, 0) ; dont inherte it ;~ _WinAPI_SetHandleInformation($hSTD_OUT_WritePipe, 1, 1) _NamedPipes_CreatePipe($hSTD_IN_ReadPipe, $hSTD_IN_WritePipe,DllStructGetPtr($tSecurity)) _WinAPI_SetHandleInformation($hSTD_IN_WritePipe, 1, 0) ; here is the problem ;~ _WinAPI_SetHandleInformation($hSTD_IN_ReadPipe, 1, 1) ;************** ; Create child process $tProcess = DllStructCreate($tagPROCESS_INFORMATION) $tStartup = DllStructCreate($tagSTARTUPINFO) DllStructSetData($tStartup, "Size", DllStructGetSize($tStartup)) DllStructSetData($tStartup, "Flags", BitOR($STARTF_USESTDHANDLES, $STARTF_USESHOWWINDOW)) DllStructSetData($tStartup, "StdOutput", $hSTD_OUT_WritePipe) DllStructSetData($tStartup, "StdError", $hSTD_OUT_WritePipe) DllStructSetData($tStartup, "StdInput", $hSTD_IN_ReadPipe) DllStructSetData($tStartup, "ShowWindow", $state) _WinAPI_CreateProcess($location, $sCmd, 0, 0, True, 0, 0, $sWorkingDir, DllStructGetPtr($tStartup), DllStructGetPtr($tProcess)) Return DllStructGetData($tProcess, "ProcessID") EndFunc ;==>_Run but I am only able to read the 1st introduction line of the Aspell.exe: after that autoit process just stop responding, I am not sure where is the issue or what is the issue. Please help me here. Thanks in Advance.
×
×
  • Create New...