自己解决了,现在把代码贴出来,希望能帮到有需要的人,使用这个方法也能与java写的class文件或者jar文件交互#include <Array.au3>
_ArrayDisplay(_InterChangeExe("Test.exe"))
Func _InterChangeExe($sConsoleProgram, $nData = "")
Local $PID = Run($sConsoleProgram, "", @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD)
StdinWrite($PID, $nData & @CRLF)
ProcessWaitClose($PID)
Local $sPut = StdoutRead($PID)
If @error <> 0 Then
MsgBox(48, "ERROR", "未获取到数据,请检查" & $sConsoleProgram & "文件是否存在!")
Return SetError(1, 0, 0)
Else
Local $aPuts = StringSplit(StringTrimRight($sPut, StringLen(@CRLF)), @CRLF)
For $i = 1 To UBound($aPuts, 1) - 1
If $i < UBound($aPuts) And $aPuts[$i] = "" Then
_ArrayDelete($aPuts, $i)
EndIf
Next
$aPuts[0] = UBound($aPuts, 1) - 1
Return $aPuts
EndIf
EndFunc ;==>_InterChangeExe
|