alongsoft 发表于 2008-10-5 17:16:09

关于输入框数据获得的问题,请指教

点下面的生成按钮后,无法根据输入框中的数据,生成。
#NoTrayIcon
#include <GUIConstants.au3>
#include <Misc.au3> ;导入一个AU3自带文件,主要用其防止重复运行程序的函数
_Singleton("TheNameOfMy") ;这个函数就是用来检测是否有相同程序在运行如果有则退出,就是只运行一次

#Region ;**** 参数创建于 AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=游戏外挂.ico
#AutoIt3Wrapper_Res_Comment=Pubwin自动开卡程序数据库初始化生成工具
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****


GUICreate("Pubwin自动开卡程序--数据库初始化生成工具", 350, 300)   ; 创建一个居中的窗口
GUISetState (@SW_SHOW)      ; 显示窗口
GUICtrlCreateGroup("起始数据编号", 10, 10, 330, 60)
$s1 = GUICtrlCreateInput ( "", "20", "32", "310" , "20" )

GUICtrlCreateGroup("需生成的数据量", 10, 100, 330, 60)
$s2 = GUICtrlCreateInput ( "", "20", "122", "310" , "20" )

GUICtrlCreateGroup("起始卡号", 10, 190, 330, 60)
$s3 = GUICtrlCreateInput ( "", "20", "212", "310" , "20" )

$Button1=guictrlcreatebutton("生成",70,265,50,20)
$Button2=guictrlcreatebutton("退出",220,265,50,20)

; ; 运行脚本直到窗口被关闭
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
      Case $GUI_EVENT_CLOSE
            Exit
      Case $Button1
                        $i = 1
                        While $i <= $s2
                        IniWrite ( "Pubwin初始数据库.ini", $s1, "卡号", $s3 )
                        IniWrite ( "Pubwin初始数据库.ini", $s1, "姓名", "" )
                        IniWrite ( "Pubwin初始数据库.ini", $s1, "身份证", "" )
                        IniWrite ( "Pubwin初始数据库.ini", $s1, "性别", "" )
                        IniWrite ( "Pubwin初始数据库.ini", $s1, "住址", "" )
                        IniWrite ( "Pubwin初始数据库.ini", $s1, "单位", "" )
                        IniWrite ( "Pubwin初始数据库.ini", $s1, "发证机构", "" )
                        IniWrite ( "Pubwin初始数据库.ini", $s1, "详细", "" )
                        $s1 = $s1 + 1
                        $s3 = $s3 + 1
                        $i = $i + 1
                        WEnd
            MsgBox ( 0, "提示", "数据库初始化完成,请确认数据生成正常,改名后使用。")
      Case $Button2
            Exit
    EndSwitch
WEnd

alongsoft 发表于 2008-10-5 17:17:28

liongodmien 发表于 2008-10-5 19:24:33

明显的逻辑错误!

liongodmien 发表于 2008-10-5 20:01:33


#NoTrayIcon
#include <GUIConstants.au3>
#include <Misc.au3> ;导入一个AU3自带文件,主要用其防止重复运行程序的函数
_Singleton("TheNameOfMy") ;这个函数就是用来检测是否有相同程序在运行如果有则退出,就是只运行一次

#Region ;**** 参数创建于 AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=游戏外挂.ico
#AutoIt3Wrapper_Res_Comment=Pubwin自动开卡程序数据库初始化生成工具
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****


GUICreate("Pubwin自动开卡程序--数据库初始化生成工具", 350, 300) ; 创建一个居中的窗口
GUISetState(@SW_SHOW) ; 显示窗口
GUICtrlCreateGroup("起始数据编号", 10, 10, 330, 60)
$s1 = GUICtrlCreateInput("", "20", "32", "310", "20")

GUICtrlCreateGroup("需生成的数据量", 10, 100, 330, 60)
$s2 = GUICtrlCreateInput("", "20", "122", "310", "20")

GUICtrlCreateGroup("起始卡号", 10, 190, 330, 60)
$s3 = GUICtrlCreateInput("", "20", "212", "310", "20")

$Button1 = GUICtrlCreateButton("生成", 70, 265, 50, 20)
$Button2 = GUICtrlCreateButton("退出", 220, 265, 50, 20)

; ; 运行脚本直到窗口被关闭
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        $1 = GUICtrlRead($s1)
                        $2 = GUICtrlRead($s2)
                        $3 = GUICtrlRead($s3)
                        For $i = $1 To ($1 + $2 - 1)
                                IniWrite("Pubwin初始数据库.ini", $i, "卡号", $3)
                                IniWrite("Pubwin初始数据库.ini", $i, "姓名", "")
                                IniWrite("Pubwin初始数据库.ini", $i, "身份证", "")
                                IniWrite("Pubwin初始数据库.ini", $i, "性别", "")
                                IniWrite("Pubwin初始数据库.ini", $i, "住址", "")
                                IniWrite("Pubwin初始数据库.ini", $i, "单位", "")
                                IniWrite("Pubwin初始数据库.ini", $i, "发证机构", "")
                                IniWrite("Pubwin初始数据库.ini", $i, "详细", "")
                                $3 = $3 + 1
                        Next
                        MsgBox(0, "提示", "数据库初始化完成,请确认数据生成正常,改名后使用。")
                Case $Button2
                        Exit
        EndSwitch
WEnd

alongsoft 发表于 2008-10-6 09:14:32

刚学,还有很多不懂,以后请大侠们多多指教

liongodmien 发表于 2008-10-6 10:12:52

原帖由 alongsoft 于 2008-10-6 09:14 发表 http://www.autoitx.com/images/common/back.gif
刚学,还有很多不懂,以后请大侠们多多指教

我是能帮就帮,不能帮也帮着想个解决办法...
页: [1]
查看完整版本: 关于输入框数据获得的问题,请指教