JohnSte Posted June 15, 2012 Share Posted June 15, 2012 I'm trying to send a password into a control. I could not get that to work. Then I discovered the Recorder and so I was able to send a hard-coded password into this control using Send (). Then we decided it would be good to have an option to set the password as opposed to having it hard-coded. So I learned how to create a variable and accept input. So far so good. However, now when I try to send the password as a variable, I have a problem. This particular control is a password/password confirmation box. To get it to work, I had to use a line like: Send ("P@ssword{TAB}P@ssword") So I tried Send ($Password{TAB}$Password) but that wasn't liked. If I wrap the variable ($Password) in quotes, everything works fine but the password is always $Password I also tried setting the line to raw mode (by using the ,1 at the end of the line) but that also failed. Ideas? Link to comment Share on other sites More sharing options...
JohnOne Posted June 15, 2012 Share Posted June 15, 2012 Post code. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
JohnSte Posted June 15, 2012 Author Share Posted June 15, 2012 Right, sorry! ; First we create the log file. $logfile = FileOpen("c:AutoItInstall.log", 2) If $logfile = -1 Then MsgBox(0, "AutoIt3 Error", "Unable to open log file.") Exit EndIf ; Now we include the current time, then write that to the log. #include <Date.au3> LogWriteLineAndFlush ("Logging started " & _NowDate() & " " & _NowTime()) ; Next we check to see if any variables were set. Otherwise we use the defaults. $password = "@Password" $installFile = "c:autoitsdsMobility_server_9.50_WinSvr2008r2_x64.exe" If $CmdLine[0] Then For $i = 1 to UBound($CmdLine)-1 $arg = $CmdLine[$i] If StringInStr($arg, "=") Then $splitArg = StringSplit($arg, '=') $argKey = $splitArg[1] $argValue = $splitArg[2] If $argKey == "/password" Then $password = $argValue EndIf If $argKey == "/installFile" Then $installFile = $argValue EndIf EndIf Next EndIf ; Next we log that we've started the process. LogWriteLineAndFlush (@CRLF & "SDS Golden Path Install Started.") ; Now we select SDS from the splash screen and go through the Warehouse portion of the install. Run ($installfile) WinWaitActive ("NetMotion Mobility XE Server Installation", "Small &Deployment Server") LogWriteLineAndFlush (@CRLF & "Selecting Small Deployment Server option from server install splash screen.") If Not Send ("!D") Then MsgBox (0, "AutoIt3 Error", "Unable to select Small Deployment Server option from server install splash screen.") LogWriteErrorAndFlush () Exit EndIf LogWriteLineAndFlush ("Selected Small Deployment Server option from server install splash screen.") WinWaitActive ("Mobility Warehouse Installation Wizard", "In addition to the primary warehouse") LogWriteLineAndFlush (@CRLF & "Clicking Next button on the Warehouse intro page.") If Not Send ("!N") Then MsgBox (0, "AutoIt3 Error", "Unable to click Next on the Warehouse intro page.") LogWriteErrorAndFlush () Exit EndIf LogWriteLineAndFlush ("Clicked Next button on the Warehouse intro page.") WinWaitActive ("Mobility Warehouse Installation Wizard", "END USER LICENSE AGREEMENT") LogWriteLineAndFlush (@CRLF & "Accepting EULA terms and clicking Next button in Warehouse Installation Wizard.") If Not Send ("!a") Then MsgBox (0, "AutoIt3 Error", "Unable to accept EULA terms in Warehouse Installation Wizard.") LogWriteErrorAndFlush () Exit EndIf LogWriteLineAndFlush ("Accepted EULA terms in Warehouse Installation Wizard.") If Not Send ("!N") Then MsgBox (0, "AutoIt3 Error", "Unable to click Next button on EULA page in Warehouse Installation Wizard.") LogWriteErrorAndFlush () Exit EndIf LogWriteLineAndFlush ("Clicked Next button on EULA page in Warehouse Installation Wizard.") LogWriteLineAndFlush ("Accepted EULA terms and clicked Next button in Warehouse Installation Wizard.") WinWaitActive ("Mobility Warehouse Installation Wizard", "Choose the Mobility warehouse install path.") LogWriteLineAndFlush (@CRLF & "Clicking Next button and taking default warehouse installation path.") If Not Send ("!N") Then MsgBox (0, "AutoIt3 Error", "Unable to click Next button and take default warehouse installation path.") LogWriteErrorAndFlush () Exit EndIf LogWriteLineAndFlush ("Clicked Next button and took default warehouse installation path.") WinWaitActive ("Mobility Warehouse Installation Wizard", "Create a Mobility warehouse password") LogWriteLineAndFlush (@CRLF & "Creating Mobility password and confirming and clicking Next button.") If Not Send ($password "{TAB}" $password) Then MsgBox (0, "AutoIt3 Error", "Unable to create Mobility warehouse password.") LogWriteErrorAndFlush () Exit ;EndIf LogWriteLineAndFlush ("Created Mobility warehouse password and confirmed password.") If Not Send ("!N") Then MsgBox (0, "AutoIt3 Error", "Unable to click Next button on Mobility warehouse password page.") LogWriteErrorAndFlush () Exit EndIf LogWriteLineAndFlush ("Clicked Next button on Mobility warehouse password page.") LogWriteLineAndFlush ("Created and confirmed Mobility password and clicked Next button.") FileWriteLine($logfile, @CRLF & "Finished at " &_NowDate () & " " & _NowTime ()) FileWriteLine($logfile, @CRLF & "Final Result:Pass") FileWriteLine($logfile, @CRLF & "Results File: c:AutoItInstall.log") FileClose($logfile) Func LogWriteLineAndFlush($line) FileWriteLine($logfile, $line) FileFlush($logfile) EndFunc Func LogWriteErrorAndFlush($line) FileWriteLine($logfile, @CRLF & "Final Result:Fail") FileWriteLine($logfile, @CRLF & "Logging Stopped " & _NowDate () & " " & _NowTime ()) FileWriteLine($logfile, @CRLF & "Results File: c:AutoItInstall.log") FileFlush ($logfile) EndFunc Link to comment Share on other sites More sharing options...
qvex21 Posted June 15, 2012 Share Posted June 15, 2012 I'm trying to send a password into a control.I could not get that to work. Then I discovered the Recorder and so I was able to send a hard-coded passwordinto this control using Send ().Then we decided it would be good to have an option to set the password as opposed to having it hard-coded. So I learned how to create a variable and accept input. So far so good.However, now when I try to send the password as a variable, I have a problem.This particular control is a password/password confirmation box. To get it to work, I had to use a line like:Send ("P@ssword{TAB}P@ssword")So I tried Send ($Password{TAB}$Password) but that wasn't liked.If I wrap the variable ($Password) in quotes, everything works fine but the password is always $Password I also tried setting the line to raw mode (by using the ,1 at the end of the line) but that also failed.Ideas?Send($Password & "{TAB}" & $Password) English is not my native language; please excuse typing errors. Link to comment Share on other sites More sharing options...
JohnSte Posted June 15, 2012 Author Share Posted June 15, 2012 I tried that too and the behavior was as if it thought it was an Alt-Tab sequence. The other open window on the system was the AutoIt editor, and the text was created at the cursor point in the editor. Link to comment Share on other sites More sharing options...
RichardL Posted June 16, 2012 Share Posted June 16, 2012 JohnSte, Look carefully at the 'Send' help re special characters, does your password contain a '!' ? Try 'Raw' mode. Put this before the send, it will make it slow so you can see what char is the problem. Opt("SenKeyDelay", 500) Richard. Link to comment Share on other sites More sharing options...
qvex21 Posted June 17, 2012 Share Posted June 17, 2012 I tried that too and the behavior was as if it thought it was an Alt-Tab sequence. The other open window on the system was the AutoIt editor, and the text was created at the cursor point in the editor.Send( $Password & Chr(9) & $Password, 1) English is not my native language; please excuse typing errors. 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