Jump to content
Sign in to follow this  
alfa

Wait download to finish

Recommended Posts

alfa

How can i make autoit to finish the download of a file in IE ?

I am trying to DL an excel file , wait for it to finish and than run excel.

Thanks in advance.

Share this post


Link to post
Share on other sites
Lemmens Peter

You could take a look at the following snippet :

...
    $Total_Size = InetGetSize($File_To_Download)
    InetGet($File_To_Download, $File_To_Save, 1, 1)
    While @InetGetActive
        sleep(250)
        $Mes_3 = "Downloading " & $File_name & " " & int((@InetGetBytesRead / $Total_Size) * 100) & " % completed..."
        TrayTip("Downloading ", $Mes_3, 10, 16)
    Wend
    ...

Share this post


Link to post
Share on other sites
guinness

Look at

Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
UEZ

You may have a look to the downloader I wrote <Tiny URL Downloader> where you can see how to wait for the download and one method to interupt it.

The GDI+ stuff is just for fun only. :unsure:

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
guinness

That bubble background is awesome!


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
alfa

You could take a look at the following snippet :

...
    $Total_Size = InetGetSize($File_To_Download)
    InetGet($File_To_Download, $File_To_Save, 1, 1)
    While @InetGetActive
        sleep(250)
        $Mes_3 = "Downloading " & $File_name & " " & int((@InetGetBytesRead / $Total_Size) * 100) & " % completed..."
        TrayTip("Downloading ", $Mes_3, 10, 16)
    Wend
    ...

Unfortunally it seems this is too much for me :unsure: Thx for the answers though.

Share this post


Link to post
Share on other sites
jvanegmond

InetGet waits for the download to finish by default. To run the file then you can use ShellExecute (assuming you download .xls or similar file).

InetGet("http://example.com/thefile.xls", "thefile.xls") ; This downloads and waits for the download to finish
ShellExecute("thefile.xls") ; this starts the just downloaded file, by finding the correct application (Excel)

Share this post


Link to post
Share on other sites
hannes08

InetGet waits for the download to finish by default. To run the file then you can use ShellExecute (assuming you download .xls or similar file).

InetGet("http://example.com/thefile.xls", "thefile.xls") ; This downloads and waits for the download to finish
ShellExecute("thefile.xls") ; this starts the just downloaded file, by finding the correct application (Excel)

Well, just as you said. Keep it Simple. :>

Anyway my appreciation for the other commenters for their work! :unsure:


Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post


Link to post
Share on other sites
alfa

The file i am trying to wait it for DL doesnt have a constant name. It changes everytime i make the report and DL it.

Thx a lot again.

Share this post


Link to post
Share on other sites
jvanegmond

The file i am trying to wait it for DL doesnt have a constant name. It changes everytime i make the report and DL it.

Thx a lot again.

It's quite hard for us to tell you how to write a script that automates IE when we have no idea on which URL to go to, which buttons to press, maybe select things from a list, do some checkbox operations. The help file has a lot of examples for _IE functions, just have a look.

But I'm sure you didn't need us to tell you that when you want to automate IE, you have to look at the IE automation library.

Edited by Manadar

Share this post


Link to post
Share on other sites
alfa

It is impossible to show the page that i am working on since it is a company page. What i can tell is it is a SAP generated report.

the link i click to get the report shows this as link

"https://www5.nikeconnect.com/sap/bw/BEx?SAP-LANGUAGE=EN&PAGENO=1&CMD=EXPORT&DATA_PROVIDER=DP&DUMMY=file%2ecsv&FORMAT=CSV&REQUEST_NO=1"

and generated csv files like SAP4LT2Z1ZJXM81P5FXXALGPEH70.csv

I just wanted to know how to check the download status in IE.

It is obviously over my paygrade :unsure: Thx

Share this post


Link to post
Share on other sites
jvanegmond

O, if all you want to do is wait for it to finish, you can do:

While Not FileExists("*.csv")
   Sleep(100)
Wend

Just make sure that no .csv files exist in the folder already. Maybe you can even do:

FileMove("*.csv", "csvbackup/*.csv")

Share this post


Link to post
Share on other sites
alfa

Thanks a lot :unsure:

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  

×