Chinasmoker Posted February 3, 2007 Share Posted February 3, 2007 (edited) CODE#include <GUIConstants.au3> $Form1 = GUICreate("测试", 483, 294, 192, 119) GUICtrlCreateLabel("测试", 16, 16, 28, 17) $no = GUICtrlCreateInput("", 112, 80, 121, 21) GUICtrlCreateLabel("号码", 48, 80, 28, 17) GUICtrlCreateLabel("密码", 48, 160, 28, 17) $pass = GUICtrlCreateInput("", 112, 152, 121, 21) GUISetState(@SW_SHOW) WinActive ("测试") WinWaitActive ("测试") GUISetState(@SW_SHOW) Select case $CMDline [1] > ("1.0e10") GUICtrlSetData (4,$CMDline[1]) Case $CMDline [1] < ("1.0e10") GUICtrlSetData (4,"") Case $CMDline [2] > ("1.0e10") GUICtrlSetData (7,$CMDline[2]) Case $CMDline [2] < ("1.0e10") GUICtrlSetData (7,"") EndSelect While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;;;;;; EndSelect WEnd Exit I ve a question : if the numerical value of $CMDline is 1234567890 , how to judge digit of a number this script is used for input number of a credentials ,if it requires ten numeral ,in fact it is 987654321 (nine) ,then dont output ,how to judge digit of a number Maybe the words I talked is not clear,but I hope someone can undersatnd ,sorry ,my En is poor, Thanks any way Edited February 4, 2007 by Chinasmoker One is never too old to learn Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 3, 2007 Moderators Share Posted February 3, 2007 (edited) If StringRegExp(GUICtrlRead($pass), '^\d{10}$') Then ;Do Something EndIf Edited February 3, 2007 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Chinasmoker Posted February 4, 2007 Author Share Posted February 4, 2007 If StringRegExp(GUICtrlRead($pass), '^\d{10}$') Then ;Do Something EndIf thanks,but can you depict easy ? One is never too old to learn Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 4, 2007 Moderators Share Posted February 4, 2007 (edited) thanks,but can you depict easy ?It's a regular expression, the string it reads is the $pass input field, it verifies there only 10 digits, no less no more in the input field read. Edit: You could also set a min and max amount of characters allowed with GUICtrlSetLimit() and use $ES_NUMBER to make sure that it is only numbers being used:$pass = GUICtrlCreateInput("", 112, 152, 121, 21, $ES_NUMBER) GUICtrlSetLimit($pass, 10, 10) Edited February 4, 2007 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Chinasmoker Posted February 5, 2007 Author Share Posted February 5, 2007 It's a regular expression, the string it reads is the $pass input field, it verifies there only 10 digits, no less no more in the input field read. Edit: You could also set a min and max amount of characters allowed with GUICtrlSetLimit() and use $ES_NUMBER to make sure that it is only numbers being used:$pass = GUICtrlCreateInput("", 112, 152, 121, 21, $ES_NUMBER) GUICtrlSetLimit($pass, 10, 10)thank you very much One is never too old to learn Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now