Jump to content
Sign in to follow this  

Need help in Auto GUI program

Recommended Posts

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)


#EndRegion ### END Koda GUI section ###

While 1

$msg = GUIGetMsg()


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...")




While 1

$line = StdoutRead($foo)

If @error Then ExitLoop

MsgBox(0, "STDOUT read:", $line)


Share this post

Link to post
Share on other sites

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")
    Msgbox(0,"Status","An error occured with number: " & @error)

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...