Bam Posted November 1, 2008 Share Posted November 1, 2008 what i want to do is have an edit box and 2 buttons (later im going to add another edit box) and after typing in ur username into the edit box i like being able to hit enter instead of clicking login cause its faster so is thier any way to type in like a user name in an edit box and then press enter with out having to go up and click login? i found ways to do it with out an edit box but i will need 2 edit boxs later on. if u want i can post the code kinda my first real script with auto it so its kinda messy Link to comment Share on other sites More sharing options...
Bert Posted November 1, 2008 Share Posted November 1, 2008 Could you tab from the text box to the button? Take a look at this example. You can tab from one control to the next. It would be simply a keystroke. #include <GUIConstants.au3> $Form1 = GUICreate("test", 364, 212, 192, 125) $Input1 = GUICtrlCreateInput("", 64, 24, 225, 21, -1, $WS_EX_CLIENTEDGE) GUICtrlSetTip(-1, "Enter name here") $Input2 = GUICtrlCreateInput("", 64, 64, 225, 21, $ES_PASSWORD, $WS_EX_CLIENTEDGE) GUICtrlSetTip(-1, "Password") $Button1 = GUICtrlCreateButton("Ok", 64, 120, 81, 25) $Button2 = GUICtrlCreateButton("Cancel", 184, 120, 105, 25) GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE or $msg = $Button2 ExitLoop Case $msg = $Button1 $name = GUICtrlRead($Input1) $Pass = GUICtrlRead($Input2) MsgBox(0, "OK Pressed", "You pressed OK" & @CRLF _ &""& @CRLF _ &"Name: "&$name& @CRLF _ &"Password: "&$pass) Exit Case Else ;;;;;;; EndSelect WEnd Exit The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Bam Posted November 2, 2008 Author Share Posted November 2, 2008 i got this error when i tried to run it. (4) : ==> Variable used without being declared.: $Input1 = GUICtrlCreateInput("", 64, 24, 225, 21, -1, $WS_EX_CLIENTEDGE) $Input1 = GUICtrlCreateInput("", 64, 24, 225, 21, -1, ^ ERROR with the script i have right now i can tab to the login button but i was trying to find an easier way sense ill probly be using it alot. Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 2, 2008 Share Posted November 2, 2008 i got this error when i tried to run it. (4) : ==> Variable used without being declared.: $Input1 = GUICtrlCreateInput("", 64, 24, 225, 21, -1, $WS_EX_CLIENTEDGE) $Input1 = GUICtrlCreateInput("", 64, 24, 225, 21, -1, ^ ERROR Add this to the top of your script: #include <WindowsConstants.au3> Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Bam Posted November 2, 2008 Author Share Posted November 2, 2008 ty PsaltyDS but now i get this and how do u know what things to #include? (7) : ==> Variable used without being declared.: $Input2 = GUICtrlCreateInput("", 64, 64, 225, 21, $ES_PASSWORD, $WS_EX_CLIENTEDGE) $Input2 = GUICtrlCreateInput("", 64, 64, 225, 21, ^ ERROR Link to comment Share on other sites More sharing options...
rasim Posted November 2, 2008 Share Posted November 2, 2008 BamUse a search in the c:\Program Files\AutoIt3\Include\ folder Link to comment Share on other sites More sharing options...
Bam Posted November 2, 2008 Author Share Posted November 2, 2008 @Volly ya thats almost like the script i have now and i just dont like having to hit the tab key a second time Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 2, 2008 Share Posted November 2, 2008 ty PsaltyDSbut now i get this and how do u know what things to #include?(7) : ==> Variable used without being declared.:$Input2 = GUICtrlCreateInput("", 64, 64, 225, 21, $ES_PASSWORD, $WS_EX_CLIENTEDGE)$Input2 = GUICtrlCreateInput("", 64, 64, 225, 21, ^ ERRORYou are using the style with GuiCtrlCreateInput(), so go to that function in the help file and click on the link in the description there for the Styles in the appendix. At the top of every section of style and extended parameters in the appendix is the include file that contains them. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Bam Posted November 2, 2008 Author Share Posted November 2, 2008 (edited) i dont see a style that will, when i press enter act like i just click login edit* like when u go into notepad (on xp) and u click save as, u have a box where u tpye the file name and if u press enter it clicks save for you. thats what i wana do Edited November 3, 2008 by Bam Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 3, 2008 Share Posted November 3, 2008 i dont see a style that will, when i press enter act like i just click loginedit*like when u go into notepad (on xp) and u click save as, u have a box where u tpye the file name and if u press enter it clicks save for you. thats what i wana doEnter triggers the button that has $BS_DEFPUSHBUTTON style on it (from #include <ButtonConstants.au3>, by the way) as though you clicked on it. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Bam Posted November 4, 2008 Author Share Posted November 4, 2008 @PsaltyDS TY ! 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