Sign in to follow this  
Followers 0
gfunk999

Download a file in IE

15 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



INetGet()

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Hrm, it's obvious that you do not have the correct link, seeing as how it won't let you download, or a page error. Try looking into the page source for a download link.

Share this post


Link to post
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")

Share this post


Link to post
Share on other sites

;) haha thx again

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

Posted Image

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

Just as an FYI for anyone else, Opera lets you view the link, IE displays it for a brief moment before it goes away.

NP

Edited by gfunk999

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