Jump to content
Sign in to follow this  

Inetget erroring

Recommended Posts

Hi guys,

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

!--------- STARTING ----------
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]")
;--------------------------  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.
    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)
Func _Terminate()
EndFunc   ;==>_Terminate
Edited by 13lack13lade

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  

  • Create New...