Jump to content
Sign in to follow this  
Kylin

How to Use GUI input?

Recommended Posts

Kylin

#include <GUIConstants.au3>

Dim $ComName,$ConnName,$ComIp,$ComMask,$ComGetway,$ComDnsP,$ComDnsS,$Com1,$Com2,$Com3,$Com4,$Com5,$Com6,$Com7
Dim $Top0,$Left,$Behind,$Width,$Width_Input,$Height,$Left_Input

$Left = 10
$Behind = 30
$Top0 = 10
$Top1 = $Top0 + $Behind
$Top2 = $Top1 + $Behind
$Top3 = $Top2 + $Behind
$Top4 = $Top3 + $Behind
$Top5 = $Top4 + $Behind
$Top6 = $Top5 + $Behind
$Width = 70
$Width_Input = 140
$Height = 15
$Left_Input = $Left + $Width


GUICreate("我的 GUI",235,255)  ; 创建一个居中显示的窗口




Opt("GUICoordMode",1)
Opt("GUIResizeMode", 1)
Opt("GUIOnEventMode", 1)
GUIStartGroup()
GUICtrlCreateLabel ("电脑名称",  $Left, $Top0, $Width)   
$Com1 = GUICtrlCreateInput ("cxvxcvxcvcxv",$Left_Input,$Top0,$Width_Input)

GUICtrlCreateLabel ("连接名称",  $Left, $Top1, $Width)   
$Com2 = GUICtrlCreateInput ("本地连接",$Left_Input,$Top1,$Width_Input)

GUICtrlCreateLabel ("IP地址",  $Left, $Top2, $Width)    
$Com3 = GUICtrlCreateInput (@IPAddress1,$Left_Input,$Top2,$Width_Input)

GUICtrlCreateLabel ("子网掩码",  $Left, $Top3, $Width)   
$Com4 = GUICtrlCreateInput ("255.255.255.0",$Left_Input,$Top3,$Width_Input)

GUICtrlCreateLabel ("默认网关",  $Left, $Top4, $Width)    
$Com5 = GUICtrlCreateInput ("192.168.1.200",$Left_Input,$Top4,$Width_Input)

GUICtrlCreateLabel ("主DNS",  $Left, $Top5, $Width)    
$Com6 = GUICtrlCreateInput ("202.103.0.117",$Left_Input,$Top5,$Width_Input)

GUICtrlCreateLabel ("主DNS",  $Left, $Top6, $Width)    
$Com7 = GUICtrlCreateInput ("202.103.44.5",$Left_Input,$Top6,$Width_Input)

$ComName = GUICtrlRead($Com1)

$ok = GUICtrlCreateButton ("确定",  10, 223, 100)
GUICtrlSetOnEvent(-1, "OKPressed")

$cancel = GUICtrlCreateButton ( "取消",  120,223, 100)
GUICtrlSetOnEvent(-1, "CancelPressed")

;各按钮按下所发生的事件
Func OKPressed()
    Call("CheckInfo")
EndFunc

Func CheckInfo()

    MsgBox(16,"IP填写有误",$ComName&"IP格式为xxx.xxx.xxx.xxx,x仅为数字")

EndFunc


Func CancelPressed()
    $msg = 0
EndFunc

GUISetState ()       ; 空窗口

; 运行脚本直到窗口被关闭
$msg = 1
While $msg = 1
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

can't get data... :)

Share this post


Link to post
Share on other sites
Xenobiologist

Hi,

maybe this helps out:

#include <GUIConstants.au3>

Dim $ComName,$ConnName,$ComIp,$ComMask,$ComGetway,$ComDnsP,$ComDnsS,$Com1,$Com2,$Com3,$Com4,$Com5,$Com6,$Com7
Dim $Top0,$Left,$Behind,$Width,$Width_Input,$Height,$Left_Input

$Left = 10
$Behind = 30
$Top0 = 10
$Top1 = $Top0 + $Behind
$Top2 = $Top1 + $Behind
$Top3 = $Top2 + $Behind
$Top4 = $Top3 + $Behind
$Top5 = $Top4 + $Behind
$Top6 = $Top5 + $Behind
$Width = 70
$Width_Input = 140
$Height = 15
$Left_Input = $Left + $Width

GUICreate("?? GUI",235,255)  ; ???????????
Opt("GUICoordMode",1)
Opt("GUIResizeMode", 1)
GUIStartGroup()
GUICtrlCreateLabel ("????",  $Left, $Top0, $Width)   
$Com1 = GUICtrlCreateInput ("cxvxcvxcvcxv",$Left_Input,$Top0,$Width_Input)
GUICtrlCreateLabel ("????",  $Left, $Top1, $Width)   
$Com2 = GUICtrlCreateInput ("????",$Left_Input,$Top1,$Width_Input)
GUICtrlCreateLabel ("IP??",  $Left, $Top2, $Width)   
$Com3 = GUICtrlCreateInput (@IPAddress1,$Left_Input,$Top2,$Width_Input)
GUICtrlCreateLabel ("????",  $Left, $Top3, $Width)   
$Com4 = GUICtrlCreateInput ("255.255.255.0",$Left_Input,$Top3,$Width_Input)
GUICtrlCreateLabel ("????",  $Left, $Top4, $Width)   
$Com5 = GUICtrlCreateInput ("192.168.1.200",$Left_Input,$Top4,$Width_Input)
GUICtrlCreateLabel ("?DNS",  $Left, $Top5, $Width)   
$Com6 = GUICtrlCreateInput ("202.103.0.117",$Left_Input,$Top5,$Width_Input)
GUICtrlCreateLabel ("?DNS",  $Left, $Top6, $Width)   
$Com7 = GUICtrlCreateInput ("202.103.44.5",$Left_Input,$Top6,$Width_Input)
$ComName = GUICtrlRead($Com1)
$ok = GUICtrlCreateButton ("OK",  10, 223, 100)
$cancel = GUICtrlCreateButton ( "Cancel",  120,223, 100)

GUISetState(@SW_SHOW)

Func CheckInfo()
    MsgBox(16,"IP????",$ComName&"IP???xxx.xxx.xxx.xxx,x????")
EndFunc

While 1
    $msg = GUIGetMsg()
    Switch $msg
        case $GUI_EVENT_CLOSE 
            ExitLoop
        Case $ok
            MsgBox(0,"","ok pressed")
        Case $cancel
            Exit
    EndSwitch       
Wend

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
Kylin

^^,Thanks.

It is a flow problem,I has an answer.

Thanks Again.

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  

×