Sign in to follow this  
Followers 0
nudicles

When does InetGetSize not work?

9 posts in this topic

I'm writing a script to automate the download and install of a program from the internet. InetGet works fine, but InetGetSize always returns 0 for this particular file. It is an EXE, and is about 700MB. There is also a text file in the same directory, 2.5MB, with which inetGetSize works fine.

Does inetGetSize only work with a limited filsize, or with certain filetypes? If so, is there an alternative?

Thanks guys,

Nudi :)

Share this post


Link to post
Share on other sites



I'm writing a script to automate the download and install of a program from the internet. InetGet works fine, but InetGetSize always returns 0 for this particular file. It is an EXE, and is about 700MB. There is also a text file in the same directory, 2.5MB, with which inetGetSize works fine.

Does inetGetSize only work with a limited filsize, or with certain filetypes? If so, is there an alternative?

Thanks guys,

Nudi :)

Could you please show some code? As far as I know there isn't a file size limit. I'll look into that though :)

Share this post


Link to post
Share on other sites

Could you please show some code? As far as I know there isn't a file size limit. I'll look into that though :)

Unfortunately the files I'm working with are on my corporate intranet, and are also a little bit of sensitive information.

Here's a simple snippet of my code without the actual details

$URL = "http://server/path/to/file/build_log.txt";works fine
;$URL = "http://server/path/to/file/installer.exe";returns 0

$size = InetGetSize($URL)
MsgBox(0, "Size of remote file:", $size)

Just some details about the two different files:

build_log.txt

size: 2,886,342 bytes

installer.exe

size: 669,161,958 bytes

Any other relevent information?

Share this post


Link to post
Share on other sites

Unfortunately the files I'm working with are on my corporate intranet, and are also a little bit of sensitive information.

-Snip- :)

Any other relevent information?

I understand your corporate concerns :)

Are you 100% sure the file is accesible? i.e- Password protected (eg-1) and make sure the URL is correct. Otherwise I can see no reason why this fails. As far as I can see there is no file size limit on inetgetsize. Try eg 2 and see if it downloads.

eg 1- Password Protection:

$url = "http://myuser:mypassword@server/files/the/one/you/need/file.exe"

Hope this helps find out why :)

Share this post


Link to post
Share on other sites

Not all servers will correctly give the file size, especially when using a proxy server.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

I understand your corporate concerns :)

Are you 100% sure the file is accesible? i.e- Password protected (eg-1) and make sure the URL is correct. Otherwise I can see no reason why this fails. As far as I can see there is no file size limit on inetgetsize. Try eg 2 and see if it downloads.

Yeah, I checked to be sure, none of the files are password protected.

I tried your script #2, what's interesting is that it never gets to the second part of the code (it seems). Anyway, I ran the following code (your code cut in half, and I added a msg box):

;Do the same as the last GUI
$url = "http://server/path/to/file.exe"
$size = InetGetSize ($url)
MsgBox(0, "Size of remote file:", $size)
InetGet ($url, @ScriptDir & "\installer.txt", 1, 1)

$Form1 = GUICreate("Downloading Resource2...", 341, 83, 193, 123)
$Progress1 = GUICtrlCreateProgress(6, 30, 330, 21)
GUICtrlSetLimit (-1, $size, 0)
$Label1 = GUICtrlCreateLabel("Downloading... "&$URL, 6, 6, 326, 20)
$Label2 = GUICtrlCreateLabel("Downloaded 1000mb\1000mb", 6, 54, 330, 20, $SS_RIGHT)
GUISetState(@SW_SHOW)

GUICtrlSetData ($Label1, "Downloading... "&$URL)
While @InetGetActive
    GUICtrlSetData ($Label2, "Downloaded "&Int (@InetGetBytesRead *1024*1024)&" mb\"&Int ($size*1024*1024)&" mb")
    Sleep (100)
    GUICtrlSetData ($Progress1, @InetGetBytesRead)
    Sleep (100)
WEnd
;Tell the user the downloads are complete.
MsgBox (0, "Complete!", "All Downloads have been completed!")

Here's where it gets funky... I get a msg popup that says the filesize is = 0, however, right after that it starts to download the file fine (showing a large number mb / 0 mb). Why would InetGet work but InetGetSize not? A problem with the server giving correct file size information? Is there a work around?

Thanks for your help! :)

(Had to modify the original reply, forgot to take out some semi-sensitive code :)

Share this post


Link to post
Share on other sites

Not all servers will correctly give the file size, especially when using a proxy server.

Yeah, I noticed that... I guess I can assume that my server falls under that category. Is there a way to be sure?

So other than InetGetSize(), is there a way to check to see if a file exists without trying to download the file itself?

Thanks guys

Share this post


Link to post
Share on other sites

Yeah, I noticed that... I guess I can assume that my server falls under that category. Is there a way to be sure?

So other than InetGetSize(), is there a way to check to see if a file exists without trying to download the file itself?

Thanks guys

I've found one of my scripts will return file sizes fine. Another exact duplicate script, just different name, will not return file sizes. It's so weird :)

-Koiron

Share this post


Link to post
Share on other sites

Yeah, I noticed that... I guess I can assume that my server falls under that category. Is there a way to be sure?

So other than InetGetSize(), is there a way to check to see if a file exists without trying to download the file itself?

Thanks guys

I would think you would know by asking your site administrator what their server is set up on :)

If you have the access you say you have, then it should be no problem using some of the FTP options (search for FTP.au3).


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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