【已解决】无法读取GUICtrlCreateInput的输入值?
本帖最后由 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 本帖最后由 netegg 于 2010-7-30 23:37 编辑
没问题呀!! 本帖最后由 lion.lee 于 2010-7-30 23:40 编辑
就是为了偷点懒嘛!之前用InputBox可以实现,但总归没那么好看,一次跳出一个对话框。呵呵! 本帖最后由 netegg 于 2010-7-30 23:41 编辑
回复 3# lion.lee
先别写ini,用msgbox试试
被你的代码迷惑了,你那个确定按钮是在输入密码以后才取值吧,你这样在前面都赋好了再确认当然没用 把前面的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)) 多谢兄台指点!已经搞定了!谢谢! 位置放错了而已 多谢了。我终于发现我之前写的定时关机的GUICtrlCreateInput函数那里用错了。
页:
[1]