mattschinkel Posted December 20, 2009 Posted December 20, 2009 Here's a sample gui script that monitors a dos based program while it is running in command prompt expandcollapse popup#include <GUIConstantsEx.au3> #include <StructureConstants.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <Constants.au3> #include <GUIConstants.au3> #include <GuiEdit.au3> #include <GuiComboBox.au3> Local $file, $btn, $msg dim $FileName[3] $wintitle = "Bootloader" $mygui = GUICreate($wintitle, 520, 110, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018); WS_EX_ACCEPTFILES $fileinput = GUICtrlCreateInput("", 10, 5, 438, 20) $output = GUICtrlCreateEdit("", 10, 30, 500, 50, $ES_AUTOVSCROLL + $WS_VSCROLL) $current_output = "" GUICtrlSetState(-1, $GUI_DROPACCEPTED) $button_open = GUICtrlCreateButton("open...", 450, 5, 60, 20) $button_run = GUICtrlCreateButton("run", 10, 85, 60, 20) GUISetState() $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $button_open $FileName = _WinAPI_GetOpenFileName("Open Hex", "All Files (*.*)") if $filename[0] > 0 Then GUICtrlSetData ($fileinput, $filename[1] & "\" & $filename[2]) endIf Case $msg = $button_run ;$run_line = @ScriptDir & "/tinybld2w.exe" & " " & GUICtrlRead ($fileinput) & " " & "-p \\.\com4" $run_line = GUICtrlRead ($fileinput) GUICtrlSetData ($output, "") $current_output = "" $foo = Run($run_line, "", @SW_hide, $STDERR_CHILD + $STDOUT_CHILD) While 1 $line = StdoutRead($foo) $current_output = $current_output & $line If @error Then ;msgbox(1,"","Error") Sleep (1000) ExitLoop Else if not($line = "") Then _guictrledit_appendtext($output, $line) endif EndIf WEnd Case $msg = $GUI_EVENT_CLOSE exit EndSelect WEnd
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now