gfunk999 Posted August 17, 2008 Share Posted August 17, 2008 (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 August 17, 2008 by gfunk999 Link to comment Share on other sites More sharing options...
=sinister= Posted August 17, 2008 Share Posted August 17, 2008 INetGet() Link to comment Share on other sites More sharing options...
gfunk999 Posted August 17, 2008 Author Share Posted August 17, 2008 (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 August 17, 2008 by gfunk999 Link to comment Share on other sites More sharing options...
=sinister= Posted August 17, 2008 Share Posted August 17, 2008 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) Link to comment Share on other sites More sharing options...
gfunk999 Posted August 17, 2008 Author Share Posted August 17, 2008 (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 August 17, 2008 by gfunk999 Link to comment Share on other sites More sharing options...
=sinister= Posted August 17, 2008 Share Posted August 17, 2008 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 More sharing options...
gfunk999 Posted August 17, 2008 Author Share Posted August 17, 2008 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 More sharing options...
=sinister= Posted August 17, 2008 Share Posted August 17, 2008 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. Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted August 17, 2008 Share Posted August 17, 2008 The right link seems to be ftp://ftp.software.ibm.com/pc/pccbbs/mobiles/79uj29us.exe .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
gfunk999 Posted August 18, 2008 Author Share Posted August 18, 2008 How did you find this link? I don't see it in source codeThe right link seems to be ftp://ftp.software.ibm.com/pc/pccbbs/mobiles/79uj29us.exe Link to comment Share on other sites More sharing options...
gfunk999 Posted August 18, 2008 Author Share Posted August 18, 2008 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 More sharing options...
AdmiralAlkex Posted August 18, 2008 Share Posted August 18, 2008 How did you find this link? I don't see it in source codeWhen I was asked if I wanted to save the file I pressed cancel and copied the link.... It wasn't very hard!! .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
gfunk999 Posted August 18, 2008 Author Share Posted August 18, 2008 haha thx againWhen I was asked if I wanted to save the file I pressed cancel and copied the link.... It wasn't very hard!! Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted August 18, 2008 Share Posted August 18, 2008 haha thx againNP .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
gfunk999 Posted August 18, 2008 Author Share Posted August 18, 2008 (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 August 18, 2008 by gfunk999 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now