Sign in to follow this  
Followers 0
13lack13lade

Inetget erroring

4 posts in this topic

#1 ·  Posted (edited)

Hi guys,

Trying to download a file but it simply gives me this back in console and doesnt download the file:

!--------- STARTING ----------
www.filepathtodownloadfile.file.csv
4096The total download size: 0
The total filesize: 0!--------- ENDING ----------
>Exit code: 0    Time: 2.491
 
 
this is the script i am using:
 
#include <IE.au3>
#Include <String.au3>
#include <Array.au3>
#include <Inet.au3>
#include <InetConstants.au3>
 
 
Global $left = 'open("'
Global $right = '");Return'
 
 
$IE_WINDOW_HANDLE_TEMP = WinGetHandle("[Class:IEFrame]")
$IE_WINDOW_HANDLE = String($IE_WINDOW_HANDLE_TEMP)
$oIE = _IEAttach ($IE_WINDOW_HANDLE,"HWND")
Sleep(400)
 
;--------------------------  View Reports Screen --------------------------------------------
;
; Run 1st Report
;
 
$o_frame = _IEFrameGetObjByName($oIE,"Main")
$o_form = _IEFormGetObjByName($o_frame, "main")
 
ConsoleWrite('!--------- STARTING ----------' & @CRLF)
 
$oTable = _IETableGetCollection($o_frame, 1) ; get the object of the first table in the form
$oElems = _IETagNameGetCollection($oTable, "button") ; get object of all td tags
$oElems1 = _IETagNameGetCollection($oTable, "button",0)
$oreport = _StringBetween($oElems1.outerhtml, $left, $right)
$ofileo = $oreport [0]
 
$fileurl = "http://www.filepath.com" & $ofileo
ConsoleWrite($fileurl & @CRLF)
 
;@TempDir &
Local $sFilePath = "C:\Users\webbth\Downloads\csv\RPT_0000181133.csv"
Local $hDownload = InetGet("filepath", $sFilePath,1,0)
; Wait for the download to complete by monitoring when the 2nd index value of InetGetInfo returns True.
    Do
        Sleep(250)
_DebugSetup()
 _DebugCOMError()
    Until InetGetInfo($hDownload,2)
;~ Sleep(2000)
    ; Retrieve the number of total bytes received and the filesize.
    Local $iBytesSize = InetGetInfo($hDownload, 0)
    Local $iFileSize = FileGetSize($sFilePath)
 
 
 
 
ConsoleWrite('!--------- ENDING ----------' & @CRLF)
;_IEQuit($oIE)
 
Func _Terminate()
    Exit
EndFunc   ;==>_Terminate
Edited by 13lack13lade

Share this post


Link to post
Share on other sites



The first parm of inetget is the URL to download from...


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

i know, i took it out due to sensitivity.. and replaced it with "filepath"

Edited by 13lack13lade

Share this post


Link to post
Share on other sites

any reasons why it does not download? it doesnt appear to error at all it just simply finishes without downloading the file.

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