bin0131 发表于 2009-1-30 08:23:01

为什么函数不能嵌套调用那

#AutoIt3Wrapper_Icon=Tc.ico   
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$f=GUICtrlCreateButton("中兴28系列按钮",200,250,60,30)
GUISetState(@SW_SHOW)
while 1
        $msg=GUIGetMsg()
   Select
        case $msg=$gui_event_close
                ExitLoop
        case$msg=$f
                zx28xl()
                EndSelect
        WEnd
Func zx28xl()
HotKeySet("{F1}","zx28")
HotKeySet("{F2}","zx28j")
GUICreate("中兴交换机vlan自动那个配置",450,450)
GUICtrlCreateLabel("请激活交换机登陆窗口后按F1做单交换机vlan:",130,5,280,20)
$a=GUICtrlCreateInput("",130,30,280,20)
GUICtrlCreateLabel("请输入pvid开始vlan:",5,30,120,20)
$b=GUICtrlCreateInput("",130,60,280,20)
GUICtrlCreateLabel("请输入端口数:",5,60,90,20)
GUICtrlCreateLabel("请激活交换机登陆窗口后按F2做级联vlan:",130,120,280,20)
$c=GUICtrlCreateInput("",130,150,280,20)
GUICtrlCreateLabel("请输入级联开始vlan:",5,150,120,20)
$d=GUICtrlCreateInput("",130,180,280,20)
GUICtrlCreateLabel("请输入级联截止vlan:",5,180,120,20)
$e=GUICtrlCreateInput("1-",130,210,280,20)
GUICtrlCreateLabel("请输入级联端口",5,210,120,20)
$g=GUICtrlCreateButton("退出",200,250,60,30)
GUISetState(@SW_SHOW)
                Func zx28j()
        for $i=GUICtrlRead($c) to GUICtrlRead($d) step 1
                send("create vlan " & $i & " name v" & $i & "{enter}")
                send("set vlan " & $i & " enable" & "{enter}")
                send("set vlan " & $i & " add port " & GUICtrlRead($e) & " tag" & "{enter}")
                next
EndFunc
Func zx28()
        $j=GUICtrlRead($a)
        for $i=1 to GUICtrlRead($b) Step 1
                send("create vlan " & $j & " name v" & $j & "{enter}")
                send("set vlan " & $j & " add port 1 tag" & "{enter}")
                send("set vlan " & $j & " add port " & $i & " untag" & "{enter}")
                send("set port " & $i & " pvid " & $j & "{enter}")
                send("set vlan " & $j & " enable" & "{enter}")
                $j = $j+1
                next
        EndFunc
while 1
        $ms=GUIGetMsg()
   Select
        case $ms=$gui_event_close
                ExitLoop
        case$ms=$g
                GUISetState(@SW_HIDE)
                        zx28xl()
                EndSelect
        WEnd
EndFunc

[ 本帖最后由 bin0131 于 2009-1-30 21:06 编辑 ]

大绯狼 发表于 2009-1-30 10:37:43

常识性错误了 楼主多看看帮助吧 函数要单独放

sxd 发表于 2009-1-30 17:13:32

一个很好的习惯写完一段 按一下ctrl + t
页: [1]
查看完整版本: 为什么函数不能嵌套调用那