nudicles Posted June 1, 2007 Share Posted June 1, 2007 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 Link to comment Share on other sites More sharing options...
BrettF Posted June 1, 2007 Share Posted June 1, 2007 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 Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
nudicles Posted June 1, 2007 Author Share Posted June 1, 2007 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? Link to comment Share on other sites More sharing options...
BrettF Posted June 2, 2007 Share Posted June 2, 2007 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 Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 4, 2007 Moderators Share Posted June 4, 2007 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. Link to comment Share on other sites More sharing options...
nudicles Posted June 4, 2007 Author Share Posted June 4, 2007 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 Link to comment Share on other sites More sharing options...
nudicles Posted June 4, 2007 Author Share Posted June 4, 2007 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 Link to comment Share on other sites More sharing options...
koiron Posted June 5, 2007 Share Posted June 5, 2007 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 guysI'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 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 5, 2007 Moderators Share Posted June 5, 2007 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 guysI 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now