Jester009 Posted January 26, 2008 Share Posted January 26, 2008 Hi Guys, I'm automating a website. I use functions in the IE.au3. The process works fine. But I have a small problem. In middle of the process a dialog box is prompted where username and password has to be entered. I use winwait functions to handle this. The problem is I would like to make this dialog box invisible... Is there a way? Thanks in advance Jester009 Link to comment Share on other sites More sharing options...
Squirrely1 Posted January 26, 2008 Share Posted January 26, 2008 (edited) You need to post the code that you have so far. Just paste it in the edit field, select it carefully, and choose "Enclose in code tags", the tenth button from the left, just above the edit field. But you might prefer to make it so the box never comes up in the first place. Elsewise, you can try to use this: WinSetState("MyLoginWindowTitle", "", @SW_HIDE) using the real title of the window in question. Edited January 26, 2008 by Squirrely1 Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
Jester009 Posted January 26, 2008 Author Share Posted January 26, 2008 Thanks for th reply Squirrely1. This is the code so far #AutoIt3Wrapper_run_debug_mode=Y #include <IE.au3> Opt("WinTitleMatchMode", 1) RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings","ProxyServer","REG_SZ","38.96.193.94:9080") RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable","REG_DWORD", 1) $IE = _IECreate("", 0, 0) _IENavigate($IE, "http://www.google.lk/", 0) Sleep(2000) WinWait("Connect to", "") ControlSetText ( "Connect to", "", "[CLASS:Edit; INSTANCE:2]", "*****") ControlSetText ( "Connect to", "", "[CLASS:Edit; INSTANCE:3]", "*****") ControlClick ( "Connect to", "OK", 1) _IELoadWait($IE) _IEQuit($IE) I have removed the user and the pass... Thanks Jester009 Link to comment Share on other sites More sharing options...
Squirrely1 Posted January 26, 2008 Share Posted January 26, 2008 (edited) Jester009 - You are welcome, for whatever help I could have been. I'm pretty sure that removing a username-password setup on your website is not secure and not your best strategy for accomplishing whatever it is your script is supposed to do. This is especially the case if you are trying to accomodate an AutoIt script when the real challenge you may be facing is that you don't know much about AutoIt or about programming quite yet. However, you do seem to know more about proxy servers than I do so far. Document your code a little - let us know what it is designed to do and for which users, just you or just anyone on the machine. Also, it should be mentioned here that the following code will not work to log someone in: ControlSetText ( "Connect to", "", "[CLASS:Edit; INSTANCE:2]", "*****") The astericks - "*" - that you see when you type-in a password in a password field are not the actual characters that are in the password field. It could be that what you really want to accomplish is to write a second, separate web page that does not need to be secured, so that users of your script do not have to login. Edited January 26, 2008 by Squirrely1 Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
Jester009 Posted January 26, 2008 Author Share Posted January 26, 2008 (edited) What I have tried to do here is set the proxy settings in the internet explorer. But the problem is that its a private proxy and it requires username and password when I try to navigate to a webpage. It's when IE is prompting for the user details. Anyways I have commented the code. Hope it helps... #AutoIt3Wrapper_run_debug_mode=Y #include <IE.au3> Opt("WinTitleMatchMode", 1) ;Following two lines change the IE proxy settings RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings","ProxyServer","REG_SZ","38.96.193.94:9080") RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable","REG_DWORD", 1) ;Creates an invisible IE $IE = _IECreate("", 0, 0) ;Navigate to google.com _IENavigate($IE, "http://www.google.lk/", 0) Sleep(2000) ;Wait for the password dialog box to appear WinWait("Connect to", "") ;Enter the username ControlSetText ( "Connect to", "", "[CLASS:Edit; INSTANCE:2]", "*****") ;Enter the pasword ControlSetText ( "Connect to", "", "[CLASS:Edit; INSTANCE:3]", "*****") ;Click ok button ControlClick ( "Connect to", "OK", 1) ;Wait till the page to load and quit _IELoadWait($IE) _IEQuit($IE) This is not the actual scenario. But what I want to accomplish is to make that password dialog box to be invisible.... I tried using the WinSetState function, but then entering information in the dialog box won't work... Thanks Jester009 PS: Just now I saw the edited part of your post... I have put * character because I did not want to reveal my login details to the public. Hope you got the idea of what I'm trying to do... Edited January 26, 2008 by Jester009 Link to comment Share on other sites More sharing options...
Squirrely1 Posted January 26, 2008 Share Posted January 26, 2008 (edited) I think I see now what you are trying to do Jester009. You want to automate getting IE to use a proxy server and then logging thru past that server. Why don't you just use your real username and password instead of those asterisks? The code should execute fairly rapidly so that no one looking over your shoulder will be able to find out what your password is. Otherwise, it can be difficult to find the right way to reference the proper window for use with the WinSetState and ControlSetText commands. Have you used the AutoIt Window Info Tool at: Start button > All Programs > AutoIt v3 > AutoIt Window Info Use it to find the real title of that login window. Using Opt("WinTitleMatchMode", 4) might help. Edited January 26, 2008 by Squirrely1 Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
Jester009 Posted January 26, 2008 Author Share Posted January 26, 2008 Thanks for the help Squirrely1 Actually I use my real username and password in the code, I just changed it to asterisks because I didn't want to post my username and password in the public forum As I said before the code executes just fine. What I need was to make the dialog box invisible just like the IE window... Link to comment Share on other sites More sharing options...
erezlevi Posted January 26, 2008 Share Posted January 26, 2008 Thanks for the help Squirrely1Actually I use my real username and password in the code, I just changed it to asterisks because I didn't want to post my username and password in the public forum As I said before the code executes just fine. What I need was to make the dialog box invisible just like the IE window...is it a dialog box that you created? or it is windows own during surfing? Link to comment Share on other sites More sharing options...
Swift Posted January 26, 2008 Share Posted January 26, 2008 No offence but are you reading squirellies posts? you really do not need to cover it....AutoIt scripts execute quite fast actually...and theres a VERY small chance they could read it...and understand it...before it sends enter/mouseclicks. if you really wanna protect it....make a small unclosable box...over it...then...use controlsend() to send it to the internet window...then delete the box. -Thanks, Swift Link to comment Share on other sites More sharing options...
Squirrely1 Posted January 26, 2008 Share Posted January 26, 2008 (edited) What I need was to make the dialog box invisible just like the IE window...While that unwanted dialog is open, leave it open and showing, on your desktop go to:Start button > All Programs > AutoIt v3 > AutoIt Window Infomake the unwanted dialog to be the active window by clicking on it, and look for the proper window title in the edit pane of the Window Info Tool. With the correct title you should be able to get WinClose or WinSetState to work for you. If that isn't working, you could look in the Help file for WinGetHandle - case there are other windows with the same name. If you are sure your window reference is good and still none of this helps, as a last resort you try using the Windows task manager to find a process that you might be able to end with ProcessClose. Good luck ! Edited January 26, 2008 by Squirrely1 Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
erezlevi Posted January 26, 2008 Share Posted January 26, 2008 (edited) well , I couldn't find how to hide it but here is some options for u: 1) use WinMove and move it out of the screen and use controlclick and controlsend to its control (best option). 2) use _WinAPI_EnableWindow($hWnd[, $fEnable = True]) not to let anyone use it after you put the user/password. 3) use _WinAPI_ShowWindow($t,3) to force the window down to minimize and the user can't bring it back up. but winsetstate should do the work. Edited January 26, 2008 by erezlevi Link to comment Share on other sites More sharing options...
Jester009 Posted January 26, 2008 Author Share Posted January 26, 2008 Thanks a lot for the replies guys. It's a windows dialog box, not created by Autoit. The reason I want it hidden is that I do not want my clients to see that there is an IE window involved. Not that I'm afraid of loosing the username and the password. I do not want that dialog box to be activated (Get focused) Both the functions winsetstate and winmove fulfill my requirement up to some extent. But the fact remains that the dialog box gets the focus (window gets activated) Anyways I really appreciate the guidance and help you guys have given me... Thanks Jester009 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