Jump to content

Download a file in IE


Recommended Posts

I built this code that downloads a BIOS file from IBM website; however, I don't think this is the most practical way of doing this. Could someone please provide some tips, or help on how to make this script more efficient? I was trying to figure a way how to do this in the background (perhaps using an XML file), but i'm not sure if this could be done with Autoit. Thanks in advance...

#include <file.au3>
#include <Process.au3>
#include <IE.au3>
#include <Array.au3>

$tabcount = "4"
AutoItSetOption("SendKeyDelay", 1000)

FileDelete(@TempDir & "\*.txt")
FileDelete(@TempDir & "\*.log")

$oIE = _IECreate("http://www-307.ibm.com/pc/support/site.wss/document.do?sitestyle=lenovo&lndocid=MIGR-63024",0, 0)
    $oTable = _IETableGetCollection ($oIE, 22)
    $aTableData = _IETableWriteToArray ($oTable, True)
    ;_ArrayDisplay($aTableData)

    $download = $aTableData[2][0]

_IELinkClickByText ($oIE, $download)

    WinWaitActive("Terms and conditions - Windows Internet Explorer", "", 10)
    Send("{TAB " & $tabcount & "}")
    Send("{enter}")

    WinWaitActive("File Download - Security Warning", "", 50)
    Send("+{TAB}")
    Send("S")
    Send("C:\BIOS.exe{Enter}")
Edited by gfunk999
Link to comment
Share on other sites

I try that it won't work. The FTP or HTTP IBM box that opens does not work.

Here's the code for INetGet(), but it doesn't work...it does download the BIOS.exe file, but it's broken. So I tried the ftp link straight from the browser and IBM does not allow this kind of transfer. However, if you do it through the GUI (mouse clicking) everything is fine, so that's why I was unable to use INetGet()

#include <file.au3>
#include <Process.au3>
#include <IE.au3>
#include <Array.au3>

$ftpsite = "http://www-307.ibm.com/pc/support/site.wss/license.do?filename=mobiles/"
$tabcount = "4"
AutoItSetOption("SendKeyDelay", 1000)

FileDelete(@TempDir & "\*.txt")
FileDelete(@TempDir & "\*.log")

$oIE = _IECreate("http://www-307.ibm.com/pc/support/site.wss/document.do?sitestyle=lenovo&lndocid=MIGR-63024",0, 0)
    $oTable = _IETableGetCollection ($oIE, 22)
    $aTableData = _IETableWriteToArray ($oTable, True)
    ;_ArrayDisplay($aTableData)

    $download = $aTableData[2][0]
    
    $download = $ftpsite & $download

    InetGet($download, "c:\BIOS.exe")

INetGet()

Edited by gfunk999
Link to comment
Share on other sites

The problem is not INetGet or a corrupt file so a reload won't do anything. If you try to download the file directly from IBM Site you also run into problems, so I think it's the site. That's why I had to use an alternate way of downloading this file. However, I still feel that my method is not the most practical and may be missing a better way of doing this.

Hrm, the file might be corrupted on your system, and by default INetGet copies the file from your local cache, try this, but no promises it will work:

INetGet($download, "C:\BIOS.exe", 1)

Edited by gfunk999
Link to comment
Share on other sites

You said if you go to the IBM site through the "gui", it works fine, but then you said if you try to download it directly from the IBM site, you run into problems. If you cannot download the file straight from a browser, then any alternative way of downloading the file will be the same.

Link to comment
Share on other sites

try this, click link http://www-307.ibm.com/pc/support/site.wss...ocid=MIGR-63024, then click on

79uj29us.exe, then I agree and you'll see that you get the option to save the file.

Now try this -> click link http://www-307.ibm.com/pc/support/site.wss...es/79uj29us.exe, click on I agree, and you'll see you get a box that only allows you to close the window, and you do not get an option to download.

You said if you go to the IBM site through the "gui", it works fine, but then you said if you try to download it directly from the IBM site, you run into problems. If you cannot download the file straight from a browser, then any alternative way of downloading the file will be the same.

Link to comment
Share on other sites

that work, thanks all... here's the new code

$ftpsite = "ftp://ftp.software.ibm.com/pc/pccbbs/mobiles/"
FileDelete(@TempDir & "\*.txt")
FileDelete(@TempDir & "\*.log")

$oIE = _IECreate("http://www-307.ibm.com/pc/support/site.wss/document.do?sitestyle=lenovo&lndocid=MIGR-63024",0, 0)
    $oTable = _IETableGetCollection ($oIE, 22)
    $aTableData = _IETableWriteToArray ($oTable, True)
    ;_ArrayDisplay($aTableData)

    $download = $aTableData[2][0]
    $download = $ftpsite & $download
    
InetGet($download, "c:\BIOS.exe")
Link to comment
Share on other sites

How did you find this link? I don't see it in source code

When I was asked if I wanted to save the file I pressed cancel and copied the link.... :D It wasn't very hard!! ;)

Posted Image

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...