自动-从控制台读取Java异常

时间:2019-01-21 09:28:59

标签: java exception command-line command autoit

我希望能够将命令行输入的结果输出到我已经设法完成的AutotIT GUI中。此命令包含一个Java调用。

不幸的是,我无法带来可能的Java异常,例如:

  

10:20:10,313信息-启动从0.0.0.0/0.0.0.0:0到122.168.11.129:2900的连接

     

storescu:连接超时:连接   java.net.ConnectException:连接定时ol.connect0(本机方法)

从我的SciTE窗口的控制台到我的GUI。 我已经尝试了google给我的有关consoleRead()函数的所有内容,但这似乎不起作用。

这是我的代码的一部分:

Func SendData()
    local $value    = GUICtrlRead($targets)
    local $target   = StringRegExpReplace($value,".*\(","")
    $target         = StringRegExpReplace($target,"\).*","")
    local $trsyntax = StringTrimLeft($value, StringInStr($value,"="))
    local $dcm4che  = GUICtrlRead($dcm4cheGUI)
    local $path     = GUICtrlRead($pathGUI)

    $command = "java -cp .\etc\storescu\;.\etc\certs;.\lib\* org.dcm4che3.tool.storescu.StoreSCU -c " & $target & " " & $path
    $cmd     = Run($command, $dcm4che,@SW_HIDE, 2)

    While True
        $sTMP = StdoutRead($cmd, False, False)
        If @error Then
            ExitLoop 1
        ElseIf $sTMP Then
            $sSTD &= $sTMP
            GUICtrlSetData($eOutput, $sTMP, 1)
        EndIf
        Sleep(100)
    WEnd
EndFunc

GUICtrlSetData将所有内容输出到一个巨大的,不可编辑的Edit字段GUI Config中:

GUICreate("SCU Testing Utility", 750, 750, (@DesktopWidth-750)/2, (@DesktopHeight-750)/2, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS, $WS_EX_ACCEPTFILES)
GUICtrlCreateLabel("Sending Target: ", 25, 13, 100, 25)
$targets = GUICtrlCreateCombo("", 125, 10, 600, 30)

GUICtrlCreateLabel("dcm4che Path: ", 25, 46, 100, 25)
$dcm4cheGUI = GUICtrlCreateInput("C:\dcm4che-5.10.5", 125, 40, 600, 25)

GUICtrlCreateLabel("File/Folder to send: ", 25, 81, 100, 25)
$pathGUI = GUICtrlCreateInput("", 125, 75, 600, 25)
GUICtrlSetState (-1, $GUI_DROPACCEPTED)

GUICtrlCreateLabel("Set Path: ", 25, 110, 100, 25)

$filebutton   = GUICtrlCreateButton("File", 125, 105, 300, 25)
$folderbutton = GUICtrlCreateButton("Folder", 425, 105, 300, 25)
$eOutput      = GuiCtrlCreateEdit("", 0, 135, 750, 585, BitOR($ES_WANTRETURN, $WS_VSCROLL, $WS_HSCROLL, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_READONLY))

$close = GUICtrlCreateButton("Close", 0, 720, 375, 30)
$send  = GUICtrlCreateButton("Send", 375, 720, 375, 30)

1 个答案:

答案 0 :(得分:0)

好吧,我必须将标志从2升至

  

$ STDERR_MERGED(0x8)=为STDOUT和STDERR提供相同的句柄。表示$ STDOUT_CHILD和$ STDERR_CHILD。