Sign in to follow this  
Followers 0
Terkes

Download file through IE in the background

2 posts in this topic

Hello,

I’m working on a script that will gather data for my MA thesis. The problem is that the whole operation should be done in the background, hidden from the user. I know how to do the following:

Posted Image

what I don’t know is how to download in the background the .csv file that will pop-up later (yep, you have to allow IE to accept pop-ups from this site). Below is my code (by default I’m using _IECreate ($link, 0, 0, 1, 1) because I want IE window to be hidden).

#include <IE.au3>

Local $link = "http://www.gpwinfostrefa.pl/palio/html.run?_Instance=cms_gpw.pap.pl&_PageID=2&_OID=141&_Lang=&_CheckSum=9211658"

;$oIE = _IECreate ($link, 0, 0, 1, 1)
$oIE = _IECreate ($link, 0, 1, 1, 1)
$oInputs = _IETagNameGetCollection ($oIE, "button")
For $oInput In $oInputs
        _IEAction($oInput, "click")
Next
Sleep(500)
$oForm = _IEFormGetObjByName ($oIE, "szukajNotowan")
$oInputs = _IETagNameGetCollection($oIE, "input")
For $oInput In $oInputs
    If (($oInput.form.name == "szukajNotowan") AND ($oInput.type == "submit")) Then
        $hwnd = _IEPropertyGet($oIE, "hwnd")
        _IEAction ($oInput, "focus")
        ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}")
    EndIf
Next
;_IEQuit($oIE)

I suppose there is no way to use InetGet in this case. But maybe someone know how to intercept this Save As window, hide it and still download this file?

Share this post


Link to post
Share on other sites



Download button launch a javascript function : <button onclick="get_instruments(this.form); return false;" style="width: 80px;">zatwierdz</button>

<script language="javascript"> 
// wyslanie AJAXem trzech wartosci z forma
// i pobranie nowego selecta wygenerowanego na ich podstawie
function get_instruments(this_form) {
if ($("#date_from").val() != '' &&
$("#date_to").val() != '' && checkFrm_szukajszukajNotowan(this_form)) {
$('#instruments').html('Ladowanie listy... Prosze czekac...');
var tab = new Object();
tab['data1'] = $("#date_from").val();
tab['data2'] = $("#date_to").val();
tab['category'] = $("#_searchCategory").val();
$.post("/palio/html.run?_Instance=cms_gpw.pap.pl&_PageID=21&_CheckSum=-1531858831", tab, show_instruments)
}
return false;
}

No hope to use inetget, and I never managed to hide this download window ! Posted Image


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
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
Sign in to follow this  
Followers 0