Moderators SmOke_N Posted March 11, 2005 Moderators Share Posted March 11, 2005 (edited) Here's my question, I'm trying to get a Username and Password entered into a script. The main GUI, will call this script, open all applications that need to be open, log on to said application, and enter password. Where am I going wrong? #include <GuiConstants.au3> ;GUI $parent1 = GUICreate("AutoLogin", 300,150) $ScreenName = GUICtrlCreateInput("Your Sign In Name", 135, 25, 150, 20 ) $Password = GUICtrlCreateInput("Password Here", 135, 65, 150, 20 ) $Button8 = GUICtrlCreateButton("Auto Start", 135, 100, 75,30) ;Pic $Pic1 = GUICtrlCreatePic("Logo1.gif", 25, 20, 75, 77) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Case $msg = $Button8 EnvSet("ScreenName", GUICtrlRead($ScreenName)) Run("C:\Program Files\PPDB 1280-1040\Login.exe" & " " & GUICtrlRead($ScreenName)) Case $msg = $Button8 EnvSet("Pass", GUICtrlRead($Password)) Run("C:\Program Files\PPDB 1280-1040\Login.exe" & " " & GUICtrlRead($Password)) ExitLoop EndSelect WEnd I'm sure the fact that i have 2 $Button8's is helping "alot". But i've done with a button under the button, without the 2nd $Button8 (which brings up double applications), and done it with adding another button. I know the codes horrible, but i'm trying. My script is calling for these cases as such: ;___Logging in your Screen Name $ScreenName = EnvGet("ScreenName") WinActivate("Login") MouseMove(761, 416) MouseDown("left") MouseMove(613, 416) MouseUp("left") Sleep(300) Send($ScreenName, 1) Send("{ENTER}") ;___Logging in your Password $Password = EnvGet("Pass") WinActivate("Login") MouseClick("Left", 615, 447) Sleep(300) Send($Password, 1) Send("{ENTER}") EndFunc ;==>do_logon Any Laymen suggestions are greatly appreciated. Thanks Ron Edited March 11, 2005 by ronsrules 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...
buzz44 Posted March 11, 2005 Share Posted March 11, 2005 (edited) Run("C:\Program Files\PPDB 1280-1040\Login.exe" & " " & GUICtrlRead should beRun("C:\Program Files\PPDB 1280-1040\Login.exe")hmmmmmmmmm... look at the correct syntax for runRun ( "filename" [, "workingdir" [, flag]] ) Parameters filename The name of the executable (EXE, BAT, COM, or PIF) to run. workingdir [optional] The working directory. flag [optional] The "show" flag of the executed program: @SW_HIDE = Hidden window @SW_MINIMIZE = Minimized window @SW_MAXIMIZE = Maximized windowwhy do u have GUICtrlRead($ScreenName)) ??, you cant have that . incorrecnt syntax . if u want to enter the values in the $screenname ans $password you could use Winwait to wait for ur "Login.exe" to open then u could "send($screenname) etc .. or sumthing similar Edited March 11, 2005 by burrup qq Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 11, 2005 Author Moderators Share Posted March 11, 2005 why do u have GUICtrlRead($ScreenName)) ??, you cant have that . incorrecnt syntax . if u want to enter the values in the $screenname ans $password you could use Winwait to wait for ur "Login.exe" to open then u could "send($screenname) etc .. or sumthing similar<{POST_SNAPBACK}>in the 2nd script there is an EnvGet. The 1st script (gui) has a label (username) varies often, and (password) that varies often. Dependent on these usernames and passwords, is what controls the functions in the 2nd script.I've decided just to make another script for the password, and add a password button, since it looks like everyone is tired of trying to help (gawd i understand that), or don't know what the heck i'm talking about.ThanksRon 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...
buzz44 Posted March 11, 2005 Share Posted March 11, 2005 still wondering about that line but ... does login.exe run at all? qq Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 11, 2005 Author Moderators Share Posted March 11, 2005 Yes, login.exe runs perfectly. well for the first action $ScreenName. Just doesn't take action for $Password. I've created another script, but would have been nice to see it work with just the 1 script. 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...
Moderators SmOke_N Posted March 12, 2005 Author Moderators Share Posted March 12, 2005 As usual, Great Job!, Thanks 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...
Moderators SmOke_N Posted March 23, 2005 Author Moderators Share Posted March 23, 2005 Wow, Larry I tried to run that script above that you helped me w/ in an executable and got a horrible CmdLine error. Anyway, I figured out !! Hooray me! I don't know if anyone can benefit from this, but It helped me tremendously. GUI script 1: #include <GuiConstants.au3> ;GUI $parent1 = GUICreate("AutoLogin", 300,150) $ScreenName = GUICtrlCreateInput("Your Sign In Name", 135, 25, 150, 20 ) $Password = GUICtrlCreateInput("Password Here", 135, 65, 150, 20 ) $Button8 = GUICtrlCreateButton("Auto Start", 135, 100, 75,30) ;Pic $Pic1 = GUICtrlCreatePic("Logo1.gif", 25, 20, 75, 77) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Case $msg = $Button8 EnvSet("foo", GUICtrlRead($ScreenName)) EnvSet("pass", GUICtrlRead($Password)) Run("C:\Program Files\PPDB 1280-1040\Login.exe" & " " & GUICtrlRead($ScreenName) & " " & GUICtrlRead($Password)) ExitLoop EndSelect WEnd The 2 EnvSet's did it. 2nd script reading the GUI: ;___Logging in your Screen Name $ScreenName = EnvGet("foo") WinActivate("Login") MouseMove(761, 416) MouseDown("left") MouseMove(613, 416) MouseUp("left") Sleep(300) Send($ScreenName, 1) Send("{ENTER}") ;___Logging in your Password $Password = EnvGet("pass") WinActivate("Login") MouseClick("Left", 615, 447) Sleep(300) Send($Password, 1) Send("{ENTER}") EndFunc;==>do_logon Best part is 1 script can read as many combo/input/labels as you want as long as you GUICtrlSetData(). I'm sure I'll get flammed for something being in the wrong syntax or calling the wrong thing or whatever anyone can find, but remember this is the 1st time in my life ever messing w/ something like this (scripting). Been a month, and purty near finished my entire program (sure it would of only taken ya'll a few hours...lol. Thanks so much for all the help! Ron 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...
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