Jump to content
Sign in to follow this  

GUI 101

Recommended Posts


Sure don't know what I am missing. I setup a simple GUI that would input a 3 digit part of an IP address. If it is blank, I want to setup the computer for a DHCP server which assigns the IP address. Then if I put in the last (10.10.40.xxx is a given) I want to setup the PC with a static IP address. The GUI doesn't release with the CASE statememts, but displays the button pushed and waits for another button. What am I missing. I can add functions and it will do all the functions and comes back to wait on another button to be pushed? Dumb Founded!


Share this post

Link to post
Share on other sites

This might help - the only part I changed was the loop and the function

; Script type:      Application
; Description:      Connects with a user-chosen ip.
; AutoIt version:   ...
; Date:             ...
; Author:           ...
#include <GUIConstantsEx.au3>
Opt("TrayIconDebug", 1)
#Region ### START Koda GUI section ### Form=c:\Menu1.kxf
$Form1_1 = GUICreate("Form1", 565, 286, 187, 120)
$Label1 = GUICtrlCreateLabel("Set computer for EOC or Town Hall", 24, 16, 515, 39)
GUICtrlSetFont(-1, 22, 800, 0, "Tahoma")
GUICtrlSetColor(-1, 0xFF0000)
$Label2 = GUICtrlCreateLabel("Enter IP address for EOC operation,", 128, 56, 303, 28)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
$Label3 = GUICtrlCreateLabel("Or leave blank, to setup for the Town Hall", 112, 88, 335, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Label4 = GUICtrlCreateLabel("10.10.40.", 160, 136, 144, 41)
GUICtrlSetFont(-1, 24, 800, 0, "MS Sans Serif")
$IP = GUICtrlCreateInput("", 304, 128, 97, 45)
GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("OK", 136, 200, 89, 41, 0)
$Button2 = GUICtrlCreateButton("Cancel", 328, 200, 89, 41, 0)
$Label5 = GUICtrlCreateLabel("03/18/2008", 240, 256, 62, 17)
#EndRegion ### START Koda GUI section ### Form=c:\Menu1.kxf

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
        Case $Button2
        ;MsgBox(4096, "EOC OR TOWN HALL", "CANCELLED", 15)
        Case $Button1
            $aIP = GUICtrlRead($IP)
        ;MsgBox(4096, "EOC OR TOWN HALL", "10.10.40." & $aIP)
        ;You can insert a function call here:
            ExitLoop; ?

Func My_Do_Connect($ipAddress)
    $where = StringInStr($ipAddress, ".", 0, 3)
    $xx = StringTrimLeft($ipAddress, $where)
    If $xx == "" Then
    ;Insert code here to "If blank, setup the computer for a DHCP server which assigns the IP address."
    ;Insert code here to "setup the PC with a given static IP address." - $ipAddress
EndFunc  ;==>My_Do_Connect

Das Häschen benutzt Radar

Share this post

Link to post
Share on other sites

This worked just fine, I do Thank you both for your help!

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.