Irongeek Posted March 11, 2010 Posted March 11, 2010 Hi all, I found some information via search, but it was out of date. I need to access a site that is using basic auth with either the _IECreate or InetGet functions. The old answer was to put the credentials in the URL like https://user:pass@someplace.com . However, Autoit uses IE, and post IE 6 credentials are disabled in the URL. Is there another way? Thanks
Irongeek Posted March 15, 2010 Author Posted March 15, 2010 It's hard to believe none else has had this problem.
99Failz Posted October 16, 2010 Posted October 16, 2010 It's hard to believe none else has had this problem. I was thinking a long the same lines... I probably looked for it for about 3 hours. I am sure there are better ways to do it but here is what I did to work with websites that have basic authentication. expandcollapse popup#include <IE.au3> #Region Vars $o_Addy = "ip or something.com" $user = "username goes here" $pass = "password goes here" #EndRegion Vars #Region Controls #cs Login window vars When using the AU3Info tool the class of the login window is $Class. The $ctrlU thru $ctrlS is the "ClassnameNN" for each textbox and button on the login window. #ce $Class = "[CLASS:#32770]" $ctrlU = "Edit2" $ctrlP = "Edit3" $ctrlS = "Button2" #EndRegion Controls #Region Navigation to login prompt $o_IE = _IECreate() #cs Allowing the script to continue while page is still loading was the tricky part for me. the zero at the end of the navigation command is "$f_wait=0". 0 does not wait for page to load and 1 waits. #ce _IENavigate($o_IE, $o_Addy, 0) #EndRegion Navigation to login prompt ;wait for 5 seconds for login window. Sleep(5000) #Region Control the login window ControlSend($Class, "", $ctrlU, $user) ControlSend($Class, "", $ctrlP, $pass) ControlClick($Class, "", $ctrlS, "") MsgBox(0, "Finished", "Bob's your uncle") #EndRegion Control the login window
KaFu Posted October 16, 2010 Posted October 16, 2010 ; http://support.microsoft.com/kb/834489 #include <IE.au3> RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE","iexplore.exe","REG_DWORD",0) _IECreate ("http://USERNAME:PASSWORD@website.com/protected_dir/") RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE","iexplore.exe","REG_DWORD",1) OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
99Failz Posted October 16, 2010 Posted October 16, 2010 Thanks KaFu, thats a much better way of doing it.
KaFu Posted October 16, 2010 Posted October 16, 2010 Glad if it helped you, you're welcome ... OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
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