Sign in to follow this  
Followers 0
aggarwal

Downloading File

6 posts in this topic

Hello

I am trying automating download a file from www.bea.gov I can easily bowse through the website and reach to the download link. But I am not able to initiate the download process. my code uptill now is

#include <IE.au3>
$oIE = _IECreate("http://www.bea.gov/itable/")
_IELinkClickByText($oIE,"GDP & Personal Income",1)
_IELinkClickByText($oIE,"Begin Using the Data...")
Sleep(1000)
_IELinkClickByText($oIE, "Personal income (SQ1)")
Sleep(2000)
$oForm = _IEFormGetObjByName($oIE, "myform7")
$oSelect = _IEFormElementGetObjByName($oForm, "7026")
_IEFormElementOptionSelect($oSelect, "Iowa", 1, "byText")
$oSelect2 = _IEFormElementGetObjByName($oForm, "7027")
_IEFormElementOptionSelect($oSelect2, "All Years", 1, "byText")
Sleep(1000)
_IEFormElementOptionSelect($oSelect2, "2011", 0, "byText")
$oSelect3 = _IEFormElementGetObjByName($oForm, "7028")
_IEFormElementOptionSelect($oSelect3, "Personal Income", 1, "byText")
$AccountButton = _IEGetObjById($oIE,'goto7')
_IEAction($AccountButton, "click")
Sleep(2000)
_IELinkClickByText($oIE, "Download")
Sleep(1000)
_IELinkClickByText($oIE, "Download XLS File")

I may be running into the problem cause after I press Download button the screen freezez and a new pop up come asking me what kind of file i want to download.

Any help in this problem will be appreciated.

Thanks

Share this post


Link to post
Share on other sites



INetGet("http://testsite.com/myfile.xx", "c:usersuserdesktop", 1,1)


Heroes, there is no such thing

One day I'll discover what IE.au3 has of special for so many users using it.
C'mon there's InetRead and WinHTTP, way better
happy.png

Share this post


Link to post
Share on other sites

I dont think that INetGet will be any helpfl cause the website produces a different link everytime I broiwse through as the content in the excel file is updated. I need a way to either get the link from the pop up button or hit that button to initiate the download process.

Share this post


Link to post
Share on other sites

After you click the download button, you want to put either a _IELoadWait or maybe something like:

Do

sleep(500)

Until WinExists("Downloads")

...but with the correct title.

Share this post


Link to post
Share on other sites

It stiull doesnt work as soon as i click download XLS file a new window pop ups for a sec and vanishes and thye autoit script keeps running!!

Share this post


Link to post
Share on other sites

the HTML component of the download button is

<a href="download.cfm?ext=xls&amp;fid=85CD5C5FD05DB9069819359089BB749068B1F7A69874E07C4C125F47FDEFAE13CC926FC9BE251D557ED3F5A8E8FE8D05F0E448B9ABAE4708056611E496046D81" onclick="clearPageLocks()" target="_blank">Download XLS File</a>

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

  • Similar Content

    • UEZ
      By UEZ
      Here a small tool I wrote to update my Sysinternal tools collection without the need to download always the whole package or visiting the site to check for updates. I know that there are several tools available (also some tools written in AutoIt) but here another one for the collection. It was good exercise for me to code it.
       
       
        
       
       
      Some files from cannot be downloaded although they are visible on the web site!
       
      Here the download link of the source code only: AutoIt Sysinternal Tools Synchronizer v0.99.1 build 2017-10-23 beta.7z  (1353 downloads previously)
      -=> Requires AutoIt version 3.3.13.20 or higher / tested on Win8.1 real machine and some VMs: Win7 / Vista / Win10
       
      Compiled exe only: @MediaFire
       
      Just select the Sysinternal Tools folder or create one and press the synchronize button to download the selected items. Click on AutoIt label (near to left upper corner) to open menu.
       
      Special thanks to LarsJ, Melba23 and mesale0077 for their help. 
       
      I've still some ideas to implement which are more gimmick related, so it is not finished yet...
      If you want to add your language please check out #Region Language. Thanks. 
       
      Please report any bug or if you have any suggestions.
       
      The language of the tool tip from each of the executable in the left list view were automatically created using Google translator and weren't checked for correctness.
       
      Br,
      UEZ
    • drorshem
      By drorshem
      Hi,
      I'm looking to create a script which will download all *.txt files from a remote FTP server.
      Once downloaded, delete all *.txt files.
       
      Can this be achieved using AutoIt ?
    • harvester2001
      By harvester2001
      Hi I need your help
      I need download backup from 200 remote pc. I calculate that I can download 20 backups in one time. I need to create loop, take localizations from txt file and start 20 downloads in one time (i want use ShellExecute and robocopy), after finish one from running 20 take another localizations from txt file until localizations finish. And I need trigger if is 7:00 pause script. I hope you know what I mean
      Many thanks for help, sorry for my english.
      This is what I got:
      #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <FileConstants.au3> #include <File.au3> #include <Array.au3> #include <Date.au3> Local $targets = @ScriptDir& "\targets.txt" Local $log_name = "\autoit.log" MsgBox($MB_SYSTEMMODAL, "", "start copy", 1) Example() Func Example() If Not FileExists($targets) Then MsgBox($MB_SYSTEMMODAL, "", "The file targets.txt - doesn't exist!") Exit EndIf FileOpen($targets, 0) Global $arr[1000] ReDim $arr[_FileCountLines($targets)+1] For $i = 1 to _FileCountLines($targets) $line = FileReadLine($targets, $i) $arr[$i] = $line ; Check if is online Local $iPing = Ping($arr[$i], 250) If $iPing Then ; ONLINE $rc = FileCopy("\\"&$arr[$i]&"\e$\backup\", @ScriptDir&"\downloads\"&$arr[$i]&"\", $FC_CREATEPATH) If $rc = 0 Then _FileWriteLog(@ScriptDir & $log_name, $arr[$i]&" ONLINE error") Else _FileWriteLog(@ScriptDir & $log_name, $arr[$i]&" ONLINE done") EndIf Else ;OFFLINE _FileWriteLog(@ScriptDir & $log_name, $arr[$i]&" OFFLINE") EndIf Next EndFunc ;==>Example MsgBox($MB_SYSTEMMODAL, "", "Finish downloads backups") Exit  
    • 31290
      By 31290
      Hi everyone, 
      Following this page:
      http://downloads.dell.com/published/pages/latitude-e5450-laptop.html
      I have to download the BIOS for the E5440 model. As I don't know in which order Dell will place the description and the link to download the file (also because the 5440 can be put in first) I'd like to make  the following piece of code to search only first the link that deals with the E5440:
      (The only thing I'm sure is that the string E5440 will be either in the first or the second position and I need to download the corresponding link)
      Local $sRead = InetRead('http://downloads.dell.com/published/pages/latitude-e5450-laptop.html', 1) ConsoleWrite(BinaryToString($sRead) & @CRLF) Local $aData = _StringBetween(BinaryToString($sRead), 'Type: BIOS', 'Category:') TrayTip("", "Downloading latest BIOS Version, please wait...", 10, 3) Local $aLinks = _StringBetween($aData[0], '<A HREF="/', '"><IMG') For $i = 0 To UBound($aLinks) - 1 $aLinks[$i] = 'http://downloads.dell.com/' & $aLinks[$i] Next Local $hDownload = InetGet($aLinks[0], @DesktopDir & "\BIOSE5450.exe", $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND) Do Sleep(250) Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE) Local $iBytesSize = InetGetInfo($hDownload, $INET_DOWNLOADREAD) Local $iFileSize = Round(FileGetSize(@DesktopDir & "\BIOSE5450.exe") / 1048576) InetClose($hDownload) MsgBox(0, "", "The latest E5450 BIOS (" & $iFileSize & " MB) have been downloaded")
      I was thinking of an string search in the array but all my attempts failed for now.
      Can someone could give me a hand over here.
       
    • 31290
      By 31290
      Hi Guys, 
      Hope you're doing fine today.
      Well, I'm trying to achieve something I want to integrate to a tool I already created.
      At work, we deploy computers massively and we use the tool to perform automatic operations. Then, we have to update the BIOS to the latest version. To avoid a heavy tool, I'd like to automatically download the latest BIOS on the Dell Website but the thing is that the name of the fail change when a new version is published. Of course, I cannot know what version will be deployed by Dell but I have this when connecting to the website:

      Thus, I don't know if the FOLDERXXXXX of the download URL will change if a new version ins deployed. 

      Here's one of the pages of a model we also use: http://www.dell.com/support/home/us/en/19/product-support/product/latitude-e5450-laptop/drivers/advanced
      Well, i'm kind of stuck here and maybe someone could point something out
      Thanks in advance