rootx Posted January 11, 2017 Share Posted January 11, 2017 (edited) I'm able to login with autoit ie object on my NAS, but if I put a htaccess protection to a folder I need to send my USER and PASS to authentication require msgbox, how can I do that with Autoit. THX Edited January 12, 2017 by rootx Link to comment Share on other sites More sharing options...
anthonyjr2 Posted January 11, 2017 Share Posted January 11, 2017 I think you can automatically login to a website requiring authentication using https://user:pass@website.com, right? Why not do that? I think for it to work using AutoIt's IE functions you need to edit the registry though: RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE","iexplore.exe","REG_DWORD",0) Then do what you want and write a 1 into the key when you're finished authenticating. rootx 1 UHJvZmVzc2lvbmFsIENvbXB1dGVyZXI= Link to comment Share on other sites More sharing options...
rootx Posted January 12, 2017 Author Share Posted January 12, 2017 (edited) 17 hours ago, anthonyjr2 said: I think you can automatically login to a website requiring authentication using https://user:pass@website.com, right? Why not do that? I think for it to work using AutoIt's IE functions you need to edit the registry though: RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE","iexplore.exe","REG_DWORD",0) Then do what you want and write a 1 into the key when you're finished authenticating. NICE, anyway I share my test... 1. verify connection status.... $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("GET", "https://192.168.1.10/myapp/", False) $oHTTP.SetCredentials("user","pass",0) $oHTTP.SetRequestHeader("Content-Type", "application/em7-resource-uri") $oHTTP.Send $oResp = $oHTTP.ResponseText $oStatusCode = $oHTTP.Status ConsoleWrite($oResp) 2. #include<IE.au3> RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE","iexplore.exe","REG_DWORD",0) ;application login $1="myname" $2="mypass" ;Create Obj $oIE=_IECreate() _IELoadWait($oIE) ;navigate _IENavigate($oIE,"https://user:pass@192.168.1.10/myapp/") ;folder access _IENavigate($oIE,"https://192.168.1.10/myapp/login.php") ; app login ;Get Username Input and Passwort Input $username=_IEGetObjById($oIE,"user_login") $password=_IEGetObjById($oIE,"user_pass") ;Set Inputs _IEFormElementSetValue($username,$1) _IEFormElementSetValue($password,$2) ;submit event Local $oSubmit = _IEGetObjByName($oIE, "submit") _IEAction($oSubmit, "click") Edited January 12, 2017 by rootx 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