Jump to content

IE Connect to ... Password Window


Recommended Posts

I am a fairly new member, just getting back to AutoIt after a dead power supply intervened. I have tried various approaches described on the pages here to work with the popup password window on IE to no avail. Here is my latest attempt:

$s_url = "http://WebSite Name Here.htm"
$oIE = _IECreate ("about:blank")
_IENavigate ($oIE, $s_url)

$oButton = _IEGetObjByName($oIE, $UserNameID)
_IEAction($oButton, "focus")
Send($UName & "{SPACE}")

$oButton = _IEGetObjByName($oIE, $PWID)
_IEAction($oButton, "focus")
Send($PW & "{SPACE}")

$oButton = _IEGetObjByName($oIE, $OKID)
_IEAction($oButton, "focus")
Send("{ENTER}")

With this approach zip happens - it just sits there.

Any Suggestions? :whistle:

vatobeto.

Edited by vatobeto
Link to comment
Share on other sites

Hmm....I have no idea what password window you are talking about....please elaborate.

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

Hmm....I have no idea what password window you are talking about....please elaborate.

OK, How do I post a jpeg image from my computer? The post image icon above didn't like the "file:///C:/...jpeg" URL I gave it.

vatobeto

Link to comment
Share on other sites

I am a fairly new member, just getting back to AutoIt after a dead power supply intervened. I have tried various approaches described on the pages here to work with the popup password window on IE to no avail. Here is my latest attempt:

$s_url = "http://WebSite Name Here.htm"
$oIE = _IECreate ("about:blank")
_IENavigate ($oIE, $s_url)

$oButton = _IEGetObjByName($oIE, $UserNameID)
_IEAction($oButton, "focus")
Send($UName & "{SPACE}")

$oButton = _IEGetObjByName($oIE, $PWID)
_IEAction($oButton, "focus")
Send($PW & "{SPACE}")

$oButton = _IEGetObjByName($oIE, $OKID)
_IEAction($oButton, "focus")
Send("{ENTER}")

With this approach zip happens - it just sits there.

What did you set the variables $UserNameID, $PWID, and $OKID to? It needs to be the HTML name fields of the input objects for the first two. HTML documents don't exactly have "buttons".* They have images with an "onclick" attribute, and you usually click them with _IEImgClick(), or submit the whole Form with just _IEFormSubmit(). Test those _IEGetObjByName() functions by checking @extended = 1 (count) after they execute.

OK, How do I post a jpeg image from my computer? The post image icon above didn't like the "file:///C:/...jpeg" URL I gave it.

It only accepts internet URLs, so you would have to post it to your web site, or one of the free hosting sites. Or you could attach the file to a post with the Attachments dialog at the bottom of the Forum editor.

:whistle:

*Edit: Duh. They do to: <input type="submit" name="Button1" value="Click Me">

Edited by PsaltyDS
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

What did you set the variables $UserNameID, $PWID, and $OKID to? It needs to be the HTML name fields of the input objects for the first two. HTML documents don't exactly have "buttons". They have images with an "onclick" attribute, and you usually click them with _IEImgClick(), or submit the whole Form with just _IEFormSubmit(). Test those _IEGetObjByName() functions by checking @extended = 1 (count) after they execute.

It only accepts internet URLs, so you would have to post it to your web site, or one of the free hosting sites. Or you could attach the file to a post with the Attachments dialog at the bottom of the Forum editor.

:whistle:

Thanks for your reply. I have encountered this exact logon system on many sites. I just happened to find this fitness site.

The screen cap:

post-22123-1184790181_thumb.gif

The html for the calling site is here:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0024)http://timinvermont.com/ -->
<HTML><HEAD><TITLE>timinvermont.com</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content="MSHTML 6.00.2900.2180" name=GENERATOR></HEAD>
<BODY>
<CENTER>
<H1>timinvermont.com</H1></CENTER><BR><BR><BR><FONT size=+3><A 
href="http://timinvermont.com/fitness/fitness.htm">Fitness and Weightlifting 
Site</A></FONT><BR><FONT size=-1><I>(completely free to access)</I></FONT> 
<BR><BR><BR><FONT size=+3><A 
href="http://timinvermont.com/vintage/index.html">Vintage Physique 
Photography</A></FONT><BR><FONT size=-1><I>(preview and signup page)</I></FONT> 
<BR><BR><BR><FONT size=+3><A 
href="http://timinvermont.com/vintage2/index.html">Vintage Physique 
Photography</A></FONT><BR><FONT size=-1><I>(member's page)</I></FONT> 
</BODY></HTML>

The final link brings up the login window shown above. I assigned the useer name string and password string to the two variables you mentioned.

vatobeto.

Link to comment
Share on other sites

Thanks for your reply. I have encountered this exact logon system on many sites. I just happened to find this fitness site.

The screen cap:

post-22123-1184790181_thumb.gif

The html for the calling site is here:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0024)http://timinvermont.com/ -->
<HTML><HEAD><TITLE>timinvermont.com</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content="MSHTML 6.00.2900.2180" name=GENERATOR></HEAD>
<BODY>
<CENTER>
<H1>timinvermont.com</H1></CENTER><BR><BR><BR><FONT size=+3><A 
href="http://timinvermont.com/fitness/fitness.htm">Fitness and Weightlifting 
Site</A></FONT><BR><FONT size=-1><I>(completely free to access)</I></FONT> 
<BR><BR><BR><FONT size=+3><A 
href="http://timinvermont.com/vintage/index.html">Vintage Physique 
Photography</A></FONT><BR><FONT size=-1><I>(preview and signup page)</I></FONT> 
<BR><BR><BR><FONT size=+3><A 
href="http://timinvermont.com/vintage2/index.html">Vintage Physique 
Photography</A></FONT><BR><FONT size=-1><I>(member's page)</I></FONT> 
</BODY></HTML>

The final link brings up the login window shown above. I assigned the useer name string and password string to the two variables you mentioned.

vatobeto.

Although it was called from inside a web page, that's just a straight Windows API dialog. This works on it:

Opt("WinTitleMatchMode", 4)

If WinExists("[CLASS:#32770]", "") Then
    $hLogon = WinGetHandle("[CLASS:#32770]")
    ControlFocus($hLogon, "", "Edit2")
    ControlSetText($hLogon, "", "Edit2", "Test.User")
    Sleep(1000)
    ControlFocus($hLogon, "", "Edit3")
    ControlSetText($hLogon, "", "Edit3", "Password")
    Sleep(1000)
    ControlFocus($hLogon, "", "Button2")
    ControlClick($hLogon, "", "Button2")
Else
    MsgBox(16, "Error", "Can't see window.")
EndIf

:whistle:

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

As I do not see any athenticating script within the header of the document you posted, I assume this site operate with an htaccess-file authentication. Therefore try to handle the popup as a regular window and not as an HTML DOM Object. Another way could be authenticating using the POST method and act direct with the server. But I don't tested this stuff with autoit, I'm only a poor security guy ^^ (watch my footer ^^)

101011

Thanks for your reply. I have encountered this exact logon system on many sites. I just happened to find this fitness site.

The screen cap:

post-22123-1184790181_thumb.gif

The html for the calling site is here:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0024)http://timinvermont.com/ -->
<HTML><HEAD><TITLE>timinvermont.com</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content="MSHTML 6.00.2900.2180" name=GENERATOR></HEAD>
<BODY>
<CENTER>
<H1>timinvermont.com</H1></CENTER><BR><BR><BR><FONT size=+3><A 
href="http://timinvermont.com/fitness/fitness.htm">Fitness and Weightlifting 
Site</A></FONT><BR><FONT size=-1><I>(completely free to access)</I></FONT> 
<BR><BR><BR><FONT size=+3><A 
href="http://timinvermont.com/vintage/index.html">Vintage Physique 
Photography</A></FONT><BR><FONT size=-1><I>(preview and signup page)</I></FONT> 
<BR><BR><BR><FONT size=+3><A 
href="http://timinvermont.com/vintage2/index.html">Vintage Physique 
Photography</A></FONT><BR><FONT size=-1><I>(member's page)</I></FONT> 
</BODY></HTML>

The final link brings up the login window shown above. I assigned the useer name string and password string to the two variables you mentioned.

vatobeto.

EDIT: rocked by a polish guy :whistle: Edited by Qualitybit
[font="Courier New"][center]Me vs. 127.0.0.1 =>> 0:2But I never give up! >:-][/center][/font]
Link to comment
Share on other sites

Although it was called from inside a web page, that's just a straight Windows API dialog. This works on it:

Opt("WinTitleMatchMode", 4)

If WinExists("[CLASS:#32770]", "") Then
    $hLogon = WinGetHandle("[CLASS:#32770]")
    ControlFocus($hLogon, "", "Edit2")
    ControlSetText($hLogon, "", "Edit2", "Test.User")
    Sleep(1000)
    ControlFocus($hLogon, "", "Edit3")
    ControlSetText($hLogon, "", "Edit3", "Password")
    Sleep(1000)
    ControlFocus($hLogon, "", "Button2")

    ControlClick($hLogon, "", "Button2")
Else
    MsgBox(16, "Error", "Can't see window.")
EndIf

:lmao:

Thanks for the reply, again! Actually - oops - that didn't work. Here is the output from the Au3Info program for the initial window:

>>>> Window <<<<

Title: timinvermont.com - Microsoft Internet Explorer

Class: IEFrame

Position: 301, 10

Size: 800, 600

Style: 0x16CF0000

ExStyle: 0x00000100

>>>> Control <<<<

Class: Internet Explorer_Server

Instance: 1

ID:

Text:

Position: 305, 181

Size: 792, 402

ControlClick Coords: 38, 175

Style: 0x56000000

ExStyle: 0x00000000

>>>> Mouse <<<<

Position: 38, 316

Cursor ID: 5

Color: 0xFFFFFF

>>>> StatusBar <<<<

1:

2:

3:

4:

5:

6:

7:

8: Internet

>>>> Visible Text <<<<

Add Tab

Close Tab

Links

http://timinvermont.com/

娨

http://timinvermont.com/

I thought that when you see : Class: Internet Explorer_Server, it means there is javascript involved. Yes?

So How would I select the third button, if all the buttons in the area are designated as Internet Explorer_Server1, as Au3Info reveals? I have seeen where some posters indicate it is necessary to use bare screen coordinates and mouseClick to accomplish this. That sort of messes up for different screen resolutions.

Here is the program code I am currently using:

#include <IE.au3>
Opt("WinTitleMatchMode", 4)

$UName = "****"
$PW = "******"
$PWWinTitle = "Connect to timinvermont.com"
$PWWinText = "Members"
$s_url = "http://timinvermont.com"

$oIE = _IECreate($s_url)
sleep(2000)
If WinExists("[CLASS:#32770]", "") Then
    $hLogon = WinGetHandle("[CLASS:#32770]")
    ControlFocus($hLogon, "", "Edit2")
    ControlSetText($hLogon, "", "Edit2", $UName)
    Sleep(1000)
    ControlFocus($hLogon, "", "Edit3")
    ControlSetText($hLogon, "", "Edit3", $PW)
    Sleep(1000)
    ControlFocus($hLogon, "", "Button2")
    ControlClick($hLogon, "", "Button2")
Else
    MsgBox(16, "Error", "Can't see window.")
EndIf
Exit

vatobeto :whistle:

Edited by vatobeto
Link to comment
Share on other sites

You misunderstand what I posted. That code handles the logon pop-up only. You have to open IE, navigate to the web page and click on the link for the "Vintage Physique Photography" with you own code (you were already there in the screen shot you posted) then run my code only to handle the logon dialog.

:whistle:

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

You misunderstand what I posted. That code handles the logon pop-up only. You have to open IE, navigate to the web page and click on the link for the "Vintage Physique Photography" with you own code (you were already there in the screen shot you posted) then run my code only to handle the logon dialog.

:lmao:

Yes, I misspoke. I added a couple of sleep statements to the code you suggested, and it worked fine. Internet Speed > Processor Speed? Muito obrigado (thanks a heap) for your aid. I can stop banging my head now.

Here is the complete code:

#include <IE.au3>
Opt("WinTitleMatchMode", 4)

$UName = "*****"
$PW = "*****"
$PWWinTitle = "Connect to timinvermont.com"
$PWWinText = "Members"
$s_url = "http://timinvermont.com"

$oIE = _IECreate()
_IENavigate($oIE,$s_url)
$MembersButton = _IETagNameAllGetCollection ($oIE, 26)
_IEAction($MembersButton, "focus")
_IEAction($MembersButton, "click")


If WinExists("[CLASS:#32770]", "") Then
    Sleep(1000)
    $hLogon = WinGetHandle("[CLASS:#32770]")
    Sleep(1000)
    ControlFocus($hLogon, "", "Edit2")
    ControlSetText($hLogon, "", "Edit2", $UName)
    Sleep(1000)
    ControlFocus($hLogon, "", "Edit3")
    ControlSetText($hLogon, "", "Edit3", $PW)
    Sleep(1000)
    ControlFocus($hLogon, "", "Button2")
    ControlClick($hLogon, "", "Button2")
Else
    MsgBox(16, "Error", "Can't see window.")
EndIf

Exit

The gurus on this forum are tops! :whistle:

vatobeto.

Link to comment
Share on other sites

You misunderstand what I posted. That code handles the logon pop-up only. You have to open IE, navigate to the web page and click on the link for the "Vintage Physique Photography" with you own code (you were already there in the screen shot you posted) then run my code only to handle the logon dialog.

:lmao:

Yes, I misspoke. I added a couple of sleep statements to the code you suggested, and it worked fine. Internet Speed > Computer Speed? Muito obrigado (thanks a heap) for your aid. I can stop banging my head now.

Here is the complete code:

#include <IE.au3>
Opt("WinTitleMatchMode", 4)

$UName = "*****"
$PW = "*****"
$PWWinTitle = "Connect to timinvermont.com"
$PWWinText = "Members"
$s_url = "http://timinvermont.com"

$oIE = _IECreate()
_IENavigate($oIE,$s_url)
$MembersButton = _IETagNameAllGetCollection ($oIE, 26)
_IEAction($MembersButton, "focus")
_IEAction($MembersButton, "click")


If WinExists("[CLASS:#32770]", "") Then
    Sleep(1000)
    $hLogon = WinGetHandle("[CLASS:#32770]")
    Sleep(1000)
    ControlFocus($hLogon, "", "Edit2")
    ControlSetText($hLogon, "", "Edit2", $UName)
    Sleep(1000)
    ControlFocus($hLogon, "", "Edit3")
    ControlSetText($hLogon, "", "Edit3", $PW)
    Sleep(1000)
    ControlFocus($hLogon, "", "Button2")
    ControlClick($hLogon, "", "Button2")
Else
    MsgBox(16, "Error", "Can't see window.")
EndIf

Exit

The gurus on this forum are tops! :whistle:

vatobeto.

Link to comment
Share on other sites

Note that often when a popup appears like that, the script will hang after the _IEAction "click" waiting for the dialog to be handled before allowing the code designed to handle the popup to run. In these cases, after doing the "focus" you need to SEND("{ENTER}") instead of the "click". This activates the button, but avoids getting trapped by the DOM waiting for a return from the click event.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Note that often when a popup appears like that, the script will hang after the _IEAction "click" waiting for the dialog to be handled before allowing the code designed to handle the popup to run. In these cases, after doing the "focus" you need to SEND("{ENTER}") instead of the "click". This activates the button, but avoids getting trapped by the DOM waiting for a return from the click event.

Dale

Makes sense (Dale always makes sense). You should follow handling the pop-up with _IELoadWait() before going on to any more processing, though you have just Exit there in the code you posted.

:whistle:

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

I'm rather new to AutoIt and really like it! Great job! but I am having an issue and would be so greatful if anyone could help me.

I tried using this code listed and the user dialog shows up and hangs there. I tried adding the "Send ("{ENTER}") instead of the Click command but that doesn't seem to help.

The only real difference between my code and the posted code is that I am going to an intranet website instead of an Internet website. Secondly I am running this on XP SP2. Not sure if this has anything to do with it but....or maybe I'm just not that good at coding this stuff!

Here is my code:

; Autostart for What's Up Gold Displays for NOC

; Program Name: NOC Display.EXE

; Author: Unknown

; Date: July 2007

; Comment: This program opens and positions all displays for the NOC monitoring PC.

#include <IE.au3>

Opt("WinTitleMatchMode", 1)

$UName = "****"

$PW = "*******"

$PWWinTitle = "Connect to"

$PWWinText = "User Name"

$s_url = "http://10.1.1.145:8008/map.asp?map=Server%20Dashboard.wup"

$s_url1 = "http://10.1.1.145:8008/map.asp?map=1%20Globe%20OCR.wup"

$oIE = _IECreate ("about:blank",0,0)

$oIE.AddressBar = 0

$oIE.MenuBar = 0

$oIE.StatusBar = 0

$oIE.ToolBar = 0

$oIE.left=1

$oIE.top=1

$oIE.width=845

$oIE.height=630

$oIE.visible=1

_IENavigate($oIE,$s_url)

Sleep(10000)

If WinExists("[CLASS:#32770]", "") Then

Sleep(1000)

$hLogon = WinGetHandle("[CLASS:#32770]")

Sleep(1000)

ControlFocus($hLogon, "", "Edit2")

ControlSetText($hLogon, "", "Edit2", $UName)

Sleep(1000)

ControlFocus($hLogon, "", "Edit3")

ControlSetText($hLogon, "", "Edit3", $PW)

Sleep(1000)

ControlFocus($hLogon, "", "Button2")

SEND("{ENTER}")

Else

MsgBox(16, "Error", "Can't see window.")

EndIf

;$oIE = _IECreate()

$oIE = _IECreate ("about:blank",0,0)

$oIE.AddressBar = 0

$oIE.MenuBar = 0

$oIE.StatusBar = 0

$oIE.ToolBar = 0

$oIE.left=50

$oIE.top=50

$oIE.width=845

$oIE.height=630

$oIE.visible=1

_IENavigate($oIE,$s_url1)

If WinExists("[CLASS:#32770]", "") Then

Sleep(1000)

$hLogon = WinGetHandle("[CLASS:#32770]")

Sleep(1000)

ControlFocus($hLogon, "", "Edit2")

ControlSetText($hLogon, "", "Edit2", $UName)

Sleep(1000)

ControlFocus($hLogon, "", "Edit3")

ControlSetText($hLogon, "", "Edit3", $PW)

Sleep(1000)

ControlFocus($hLogon, "", "Button2")

SEND("{ENTER}")

Else

MsgBox(16, "Error", "Can't see window.")

EndIf

Exit

Again any help would be greatly appreciated!

Link to comment
Share on other sites

Opt("WinTitleMatchMode", 4)

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

Not that this probably makes any difference but the dialog box shown and the one I get are slightly different. I have attached a copy of the dialog box that I receive. Could it be that it has a different CLASS ID????

post-25565-1185482455_thumb.jpg

Link to comment
Share on other sites

  • 3 weeks later...

Same here im stuck at the same prompt kicking the same cat down the hallway because this script just does not want to work!

this is the whole script no gimics im down to just the login

#include <IE.au3>

Opt("WinTitleMatchMode", 4)

$UName = "******"

$PW = "******"

$oIE = _IECreate("http://mysite.com")

If WinExists("[CLASS:#32770]", "") Then

Sleep(1000)

$hLogon = WinGetHandle("[CLASS:#32770]")

Sleep(1000)

ControlFocus($hLogon, "", "Edit2")

ControlSetText($hLogon, "", "Edit2", $UName)

Sleep(1000)

ControlFocus($hLogon, "", "Edit3")

ControlSetText($hLogon, "", "Edit3", $PW)

Sleep(1000)

ControlFocus($hLogon, "", "Button2")

ControlClick($hLogon, "", "Button2")

Else

MsgBox(16, "Error", "Can't see window.")

EndIf

Exit

//Please help me

Disclaimer:lordicast does not support hurting animals thank you that is all.

[Cheeky]Comment[/Cheeky]
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...