I want to be able to download this file automatically without user assistance, for now i use IE to download this file (_IECreate, _IEFormElementSetValue, _IEFormSubmit) the problem with this I can't automate IE download dialog, so i need click the dialog first, anyone who cares with my problem?

Share this post

Link to post

Share on other sites

mmfalcao 0

mmfalcao 0

Use the WinHTTP.udf for apply method post and send as a parameters the login and password and create a function to save the document.

Remember you need check the navigation before that login, test many times, for you check how it works, some pages has changes in the access when you run every time, is that why you can expect timeout or another page, or the login again.

Regards,

mmfalcao

Share this post

Link to post

Share on other sites

trancexx 915

trancexx 915

Based on the data you provided it would probably be something like this:

#include "WinHttp.au3"GlobalConst$sUserName="YourEmail@address.com"GlobalConst$sPassword="SuperSecretPassword"; Initialize and get session handle$hOpen=_WinHttpOpen(); Get connection handle$hConnect=_WinHttpConnect($hOpen,"login.xero.com",$INTERNET_DEFAULT_HTTPS_PORT); Fill login form:$sRead=_WinHttpSimpleFormFill($hConnect,_Default,_; location of the form"LoginForm",_; id of the form"name:userName",$sUserName,_"name:password",$sPassword); You can check both @error and inspect $sRead to see if login was good;~ ConsoleWrite($sRead & @CRLF); Close connection handle_WinHttpCloseHandle($hConnect); Open new connection handle$hConnect=_WinHttpConnect($hOpen,"go.xero.com",$INTERNET_DEFAULT_HTTPS_PORT)$vXLS=_WinHttpSimpleSSLRequest($hConnect,_Default,_"Reports/ExcelReport.aspx?reportId=aebe4549-3743-484d-bc88-906d6d277cdf&report=&statement=17e61be5-f96b-478c-8ef1-a41b0bbe33e6&attPage=",_Default,_Default,_Default,_Default,_2); BINARY; Close connection handle_WinHttpCloseHandle($hConnect); Close session handle_WinHttpCloseHandle($hOpen); Do whatever with this data, save to file or just print to console like I'm doing hereConsoleWrite($vXLS&@CRLF);$hFile = FileOpen(@DesktopDir & "\test.xls", 18) ; Binary;FileWrite($hFile, $bXLS);FileClose($hFile);The End

Share this post

Link to post

Share on other sites

ngskicker 1

ngskicker 1

Based on the data you provided it would probably be something like this:

#include "WinHttp.au3"GlobalConst$sUserName="YourEmail@address.com"GlobalConst$sPassword="SuperSecretPassword"; Initialize and get session handle$hOpen=_WinHttpOpen(); Get connection handle$hConnect=_WinHttpConnect($hOpen,"login.xero.com",$INTERNET_DEFAULT_HTTPS_PORT); Fill login form:$sRead=_WinHttpSimpleFormFill($hConnect,_Default,_; location of the form"LoginForm",_; id of the form"name:userName",$sUserName,_"name:password",$sPassword); You can check both @error and inspect $sRead to see if login was good;~ ConsoleWrite($sRead & @CRLF); Close connection handle_WinHttpCloseHandle($hConnect); Open new connection handle$hConnect=_WinHttpConnect($hOpen,"go.xero.com",$INTERNET_DEFAULT_HTTPS_PORT)$vXLS=_WinHttpSimpleSSLRequest($hConnect,_Default,_"Reports/ExcelReport.aspx?reportId=aebe4549-3743-484d-bc88-906d6d277cdf&report=&statement=17e61be5-f96b-478c-8ef1-a41b0bbe33e6&attPage=",_Default,_Default,_Default,_Default,_2); BINARY; Close connection handle_WinHttpCloseHandle($hConnect); Close session handle_WinHttpCloseHandle($hOpen); Do whatever with this data, save to file or just print to console like I'm doing hereConsoleWrite($vXLS&@CRLF);$hFile = FileOpen(@DesktopDir & "\test.xls", 18) ; Binary;FileWrite($hFile, $bXLS);FileClose($hFile);The End

Hi @trancexx you are really my hero, many many thanks, even after 7 months I still need this, before this I try to automate IE download, but its buggy with many IE version,

Your solution works, but now the problem is the downloaded data (.xls file) is truncated I only got a few lines when I open the file on MS Excel, can you explan to me?