scriptomator Posted July 16, 2010 Share Posted July 16, 2010 i saw something a long time ago that did detection sort of like the way i want it done this but i can't remember where it was or how it is done. i was hoping to look at the script and apply it to mine. i screwed around with a couple of different things...but failedhere is my script. all i need help with is where the >>>> are, my explanation of what i wanted to do is in the ""Thanks a lot in advance.expandcollapse popup#include <GUIConstants.au3> #include <Constants.au3> #include <File.au3> #include <GuiStatusBar.au3> #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <StaticConstants.au3> #include <GuiButton.au3> #include <GuiEdit.au3> #Include <WinAPI.au3> #include <AVIConstants.au3> #include <WindowsConstants.au3> #include <TreeViewConstants.au3> #include <IE.au3> #Include <Misc.au3> $MAIN_GUI = GUICreate("Detection Test",250,300) $INPUT_1 = GUICtrlCreateInput("",0,0,198,30,BitOR($BS_PUSHLIKE,$SS_CENTER)) $INPUT_2 = GUICtrlCreateInput("",0,32,198,30,BitOR($BS_PUSHLIKE,$SS_CENTER)) GUICtrlSetFont($INPUT_1, 14, 510, "", "Candara") GUICtrlSetFont($INPUT_2, 14, 510, "", "Candara") $ANSWER = GUICtrlCreateEdit("", 0, 64, 198, 214) GUISetState() ;_invalid_detection() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd ;Func _invalid_detection() Do $1 = GUICtrlRead($INPUT_1) $2 = GUICtrlRead($INPUT_2) If "there is an input of any character other than the characters 0-9" Then >>>>>>>>>>>>> GUICtrlSetData($ANSWER,"Invalid character! The input boxes can only contain numbers") Beep(350,350) If "there is an input of any character other than the characters 0-9" Then >>>>>>>>>>>>> GUICtrlSetData($ANSWER,"Invalid character! The input boxes can only contain numbers") Beep(350,350) Until $msg = $GUI_EVENT_CLOSE EndFunc Link to comment Share on other sites More sharing options...
Robjong Posted July 16, 2010 Share Posted July 16, 2010 (edited) Hi, This might help.... If StringRegExp($sString, "[^\d]+") Then ; If the value of $sString is not a digit I think in your script it might be better to just set the input to a number only input. expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $MAIN_GUI = GUICreate("Detection Test",250,300) $INPUT_1 = GUICtrlCreateInput("",0,0,198,30,BitOR($BS_PUSHLIKE,$SS_CENTER,$ES_NUMBER)) ; set to number only control using $ES_NUMBER $INPUT_2 = GUICtrlCreateInput("",0,32,198,30,BitOR($BS_PUSHLIKE,$SS_CENTER,$ES_NUMBER)) ; same here GUICtrlSetFont($INPUT_1, 14, 510, "", "Candara") GUICtrlSetFont($INPUT_2, 14, 510, "", "Candara") $ANSWER = GUICtrlCreateEdit("", 0, 64, 198, 214) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit ;~ Case $INPUT_1, $INPUT_2 ;~ _invalid_detection() EndSwitch Sleep(25) WEnd ;~ Func _invalid_detection() ;~ Local $1 = GUICtrlRead($INPUT_1) ;~ Local $2 = GUICtrlRead($INPUT_2) ;~ If StringRegExp($1, "[^\d]+") Then ;~ GUICtrlSetData($ANSWER,"Invalid character! The input boxes can only contain numbers") ;~ Beep(350,350) ;~ ElseIf StringRegExp($2, "[^\d]+") Then ;~ GUICtrlSetData($ANSWER,"Invalid character! The input boxes can only contain numbers") ;~ Beep(350,350) ;~ EndIf ;~ EndFunc Edited July 16, 2010 by Robjong Link to comment Share on other sites More sharing options...
scriptomator Posted July 16, 2010 Author Share Posted July 16, 2010 ummm.......I did not know you could do that. thanks a lot. where did you find the list of variables to use($ES_NUMBER)? i found out the other two from an example script Link to comment Share on other sites More sharing options...
Robjong Posted July 16, 2010 Share Posted July 16, 2010 (edited) Hey again,In the AutoIt help file, in this case at GUICtrlCreateInput.If you use SciTE4AutoIt just press F1 in the editor, if not you realy should get it.To open the helpfile from SciTE you must have a .au3 file opened and if you select a function/macro etc. and then press F1 you get the documentation for the selected code. SciTE4AutoItOnline AutoIt Documentation Edited July 16, 2010 by Robjong Link to comment Share on other sites More sharing options...
scriptomator Posted July 16, 2010 Author Share Posted July 16, 2010 (edited) i never really took a good look at all of the shortcut keys and tools of autoit. so that is a big help to me.thanks Edited July 16, 2010 by scriptomator 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