找回密码
 加入
搜索
查看: 2955|回复: 3

[GUI管理] 怎样做一个GUI界面实时回显bat返回

[复制链接]
发表于 2015-5-21 15:34:36 | 显示全部楼层 |阅读模式
我写了一个aa.bat,运行后不停循环的,想做个GUI界面实晨回显bat返回的结果。
没做过GUI,请教下大家
好像GUI也没什么教程看
发表于 2015-5-21 20:01:54 | 显示全部楼层
;-------------------------------------------------------
#include <Constants.au3>
Opt("MustDeclareVars",1)
;----------------------------------------------------------
_test()
Func _test()
Local $foo,$line,$lines
$foo = Run(@ComSpec & " /c ping www.baidu.com", @SystemDir, @SW_HIDE, $STDOUT_CHILD)
$lines = ""
While 1
$line = StdoutRead($foo)
If @error Then ExitLoop
    $lines &= $line
Wend
MsgBox(0,"test",$lines)
EndFunc
;-----------------------------------------------------
论坛上给你搜的源码,直接截取回显,要善于运用搜索.
 楼主| 发表于 2015-5-22 16:40:32 | 显示全部楼层
回复 2# FluxayX

不是运行一条命令回显,是运行一个bat,不停循环的,实时回显
发表于 2015-5-25 10:32:13 | 显示全部楼层
沒跑代碼...不過我想不斷印出 $line 應該就可以了吧?
使用 GUICtrlSetData 套用下面GUI.

GUI 供你參考:
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 321, 438, 192, 124)
$Edit1 = GUICtrlCreateEdit("", 8, 40, 297, 385)
GUICtrlSetData(-1, "Logs will display here.")
$Label1 = GUICtrlCreateLabel("DOS Display", 8, 8, 100, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Sleep (5000)
GUICtrlSetData($Edit1, "Write your messages." & @CRLF, 1)

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
        EndSwitch
WEnd
Koda tool 可用於產生GUI介面:

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-6-11 12:15 , Processed in 0.080002 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表