markdui 0 Posted September 17, 2007 Hi i being trying to write a program to try out Autoit GUI but got stuck soon after. Had try reading the help but to no available solution. Hope someone can help me out on this little project of mine. My Project. Create a simple windows application with A button Input box and Output box HOw it work The button will call a batch file (command in batch file - ping.exe), grap the input from inputbox. process the command and sent output to outputbox button - ping.exe inputbox - hostname (user will type in a hostname) outputbox - display ping result My code #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 633, 447, 193, 125) $Edit1 = GUICtrlCreateEdit("", 40, 200, 401, 177) GUICtrlSetData(-1, "Edit1") $Button1 = GUICtrlCreateButton("Button1", 40, 56, 185, 49, 0) $Input1 = GUICtrlCreateInput("Input1", 248, 56, 169, 21) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $msg = GUIGetMsg() Select Case $msg = $Button1 ;$foo = ;Runwait("ipconfig.bat", "C:\Work\Others\AutoitScript", @SW_HIDE) Runwait(@ComSpec & " /c " & 'ipconfig.bat', "C:\Work\Others\AutoitScript", @SW_MINIMIZE) Case $msg = $GUI_EVENT_CLOSE MsgBox(0, "GUI Event", "You clicked CLOSE! Exiting...") ExitLoop EndSelect WEnd While 1 $line = StdoutRead($foo) If @error Then ExitLoop MsgBox(0, "STDOUT read:", $line) Wend Share this post Link to post Share on other sites
tAKTelapis 1 Posted September 17, 2007 Several points to make: Have a look at _RunDos() and StdoutRead() Also, AutoIt has an inbuilt Ping function (though you may be after all of the details of the ping response). $hostname = Inputbox("Hostname", "Which computer would you like to ping?") $response = Ping($hostname, 250) If $response Then; also possible: If @error = 0 Then ... Msgbox(0,"Status","Online, roundtrip was:" & $response & " ms") Else Msgbox(0,"Status","An error occured with number: " & @error) EndIf Share this post Link to post Share on other sites