找回密码
 加入
搜索
查看: 2732|回复: 7

[AU3基础] 【已解决】无法读取GUICtrlCreateInput的输入值?

  [复制链接]
发表于 2010-7-30 23:22:39 | 显示全部楼层 |阅读模式
本帖最后由 lion.lee 于 2010-7-31 00:12 编辑

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("密码配置文件生成", 297, 203, -1, -1)
$EnterPassLabel = GUICtrlCreateLabel("请输入Lotus密码:", 16, 36, 102, 17, 0)
$EnterPassLabe2 = GUICtrlCreateLabel("请输入W3密码:", 17, 77, 93, 17, 0)
$EnterPassLabe3 = GUICtrlCreateLabel("请输入域密码:", 17, 122, 88, 17, 0)
$lotus = GUICtrlRead(GUICtrlCreateInput("password", 120, 32, 153, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_PASSWORD)))
$w3 = GUICtrlRead(GUICtrlCreateInput("password", 121, 77, 153, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_PASSWORD)))
$china = GUICtrlRead(GUICtrlCreateInput("password", 121, 117, 153, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_PASSWORD)))
#cs
现象:
1、使用$lotus = GUICtrlRead(GUICtrlCreateInput。。。。时不管输入什么都返回的都是默认值;
2、使用$lotus = GUICtrlCreateInput。。。。时不管输入什么都返回的都是6;
#ce
$ButtonOk = GUICtrlCreateButton("确定(&O)", 30, 160, 75, 25, $BS_NOTIFY)
$ButtonCancel = GUICtrlCreateButton("取消(&C)", 183, 160, 75, 25, $BS_NOTIFY)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $ButtonOk
                        IniWrite(@ScriptDir & "\Password.ini", "config", "lotus", $lotus)
                        IniWrite(@ScriptDir & "\Password.ini", "config", "w3", $w3)
                        IniWrite(@ScriptDir & "\Password.ini", "config", "china", $china)
                        FileSetAttrib(@ScriptDir & "\Password.ini", "+H")
                        Send("!{f4}")
                        Sleep(1000)
                        MsgBox(64, "通知", "配置文件已经自动生成,请确认!", 1)
                        ShellExecute(@ScriptDir & "\Password.ini")
                        Sleep(3000)
                        Send("!{f4}")
                Case $ButtonCancel
                        Exit
        EndSwitch
WEnd
发表于 2010-7-30 23:32:25 | 显示全部楼层
本帖最后由 netegg 于 2010-7-30 23:37 编辑

没问题呀!!
 楼主| 发表于 2010-7-30 23:36:27 | 显示全部楼层
本帖最后由 lion.lee 于 2010-7-30 23:40 编辑

就是为了偷点懒嘛!之前用InputBox可以实现,但总归没那么好看,一次跳出一个对话框。呵呵!
发表于 2010-7-30 23:38:53 | 显示全部楼层
本帖最后由 netegg 于 2010-7-30 23:41 编辑

回复 3# lion.lee

先别写ini,用msgbox试试
被你的代码迷惑了,你那个确定按钮是在输入密码以后才取值吧,你这样在前面都赋好了再确认当然没用
发表于 2010-7-30 23:47:18 | 显示全部楼层
把前面的guictrlread都去掉
后面的               IniWrite(@ScriptDir & "\Password.ini", "config", "lotus", $lotus)
                        IniWrite(@ScriptDir & "\Password.ini", "config", "w3", $w3)
                        IniWrite(@ScriptDir & "\Password.ini", "config", "china", $china)
改成               IniWrite(@ScriptDir & "\Password.ini", "config", "lotus",guictrlread($lotus))
                        IniWrite(@ScriptDir & "\Password.ini", "config", "w3", guictrlread($w3))
                        IniWrite(@ScriptDir & "\Password.ini", "config", "china", guictrlread($china))
 楼主| 发表于 2010-7-31 00:06:23 | 显示全部楼层
多谢兄台指点!已经搞定了!谢谢!
发表于 2010-7-31 00:39:25 | 显示全部楼层
位置放错了而已
发表于 2011-1-14 13:05:41 | 显示全部楼层
多谢了。我终于发现我之前写的定时关机的GUICtrlCreateInput函数那里用错了。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-10-2 16:16 , Processed in 0.076368 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表