Jump to content
Sign in to follow this  

Download file through IE in the background

Recommended Posts


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")
$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}")

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 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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...