Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Auto Enter Credentials in Chrome Pop-Up


  • Please log in to reply
5 replies to this topic
BzowK
  • Members
  • 4 posts
  • Last active: Feb 27 2014 06:08 PM
  • Joined: 02 Feb 2012

Hey Guys - 

 

I have a Windows 7 x64 box that runs about 5-6 web apps that I often use.  I usually access them using Google Chrome on either my laptop or locally on the server via an RDP session.  Each time I go to them, I am prompted to enter a username / password to continue.  It's not a huge hassle, but with frequent use, it builds up so am looking for a way to automate this and thought about AHK.

 

I am trying to make a script continuously look for that specific window, then once it appears have it automatically enter the username, password, then hit enter once done - without using a hotkey or other manual trigger.  

 

Each of the authentication prompts (per web app) looks the same except for the address in it's description.  All of them have the same username and password, though, so hopefully that will make things easier.

 

I opened the prompt in Chrome, then opened AHK Spy beside it as you can see below.  However, I don't know how to script AHK to look for this specific window.

AHK1.png

 

I can easily create a script which will enter the credentials and continue with a hotkey, but as I access it from my iPad (via RDP) sometimes, this isn't that helpful either and would prefer it be 100% automated.  Below is what works with the hotkey

^!1::
Sendinput, username{tab}password{enter}
return

I substituted the words username/password for the actual credentials above

 

I looked through the forums and found a few scripts which seemed may work, but I couldn't get them to.  Below is the one I thought would have had the best chance of working - even though it seems to still require a hotkey for some reason...

#IfWinActive Connect to page ahk_class Chrome_WidgetWin_1
^!q::
ControlSetText, edit2, username,A
ControlSetText, edit3, password,A
ControlClick, button3,A
Return
#IfWinActive

I substituted the words username/password for the actual credentials above

 

So...  Anyone have any ideas?  Thanks!

 


tyrer
  • Members
  • 270 posts
  • Last active: Apr 10 2015 05:10 PM
  • Joined: 23 Sep 2012
SetTitleMatchMode, 2

Loop
 {
   winwaitactive, put window title here
   WinGetActiveTitle, windowname
   sleep 500
   Sendinput, username{tab}password{enter}
   WinWaitNotActive, %windowname%
   sleep,  200
 }

return

you could try this. Replace "put window title here" with title of your pop-up window(or part of it).



BzowK
  • Members
  • 4 posts
  • Last active: Feb 27 2014 06:08 PM
  • Joined: 02 Feb 2012

Thank you.  Sorry it took a while to reply, but been afk...

 

I tried doing so, but still no go.  Below's the script I used.  I got the name from AHK spy - but - chrome seems to label tabs instead.  Anyways, was it what you were suggesting?

 

SetTitleMatchMode, 2


Loop
 {
   winwaitactive, Chrome_WidgetWin_1
   WinGetActiveTitle, windowname
   sleep 500
   Sendinput, username{tabpassword@{enter}
   WinWaitNotActive, %windowname%
}

Thanks!

 

UPDATE

 

After posting the above message, I realized that I hadn't copied over all of the code you sent.  I tried it again (with all the code this time) but still no luck.  I tried changing a couple of other things, too, but still can't get it to work automatically.  Below are the two I tried:

 

SetTitleMatchMode, 2


Loop
 {
   winwaitactive, SSL Error - Google Chrome
   WinGetActiveTitle, windowname
   sleep 500
   Sendinput, myusername{tab}mypassword@{enter}
   WinWaitNotActive, %windowname%
   sleep,  200
 }


return

 

SetTitleMatchMode, 2


Loop
 {
   winwaitactive, Chrome_WidgetWin_1
   WinGetActiveTitle, windowname
   sleep 500
   Sendinput, myusername{tab}mypassword@{enter}
   WinWaitNotActive, %windowname%
   sleep,  200
 }


return

I ran AHK spy again, but got the same results as originally posted.  Any other ideas or is this what you suggested I try before?

 

Thanks!



tyrer
  • Members
  • 270 posts
  • Last active: Apr 10 2015 05:10 PM
  • Joined: 23 Sep 2012
Try

Winwaitactive, ahk_class Chrome_WidgetWin_1

tyrer
  • Members
  • 270 posts
  • Last active: Apr 10 2015 05:10 PM
  • Joined: 23 Sep 2012
Sorry thats not going to work, I didnt realise all chrome windows are of that class.

tyrer
  • Members
  • 270 posts
  • Last active: Apr 10 2015 05:10 PM
  • Joined: 23 Sep 2012
Use this to get the window name:

WinGetTitle, Title, A
MsgBox, The active window is "%Title%".