InternetFileRead()
As the name suggests, this function reads a file from internet (passed to it as URL).
It is similar to AHK FileRead command in following ways:
1) Reads the content into Memory Variable
2) Can read the specified number of bytes from the leading part of the file.
3) Data retrieved will be in binary ( but to process it, we are on our own )
Parameters :
- V : Variable name passed as ByRef
- URL : A valid existing URL from which File will be read from
- RB : Requested Bytes. Pass 0 to read the whole file or request the number of bytes to read.
- bSz : Buffer Size.
Default value is 1024 ( bytes ). File will be read in small chunks as
specified with this parameter. You can increase it for faster downloads
but should result in less responsive GUI.
- DLP : The dynamic function name of the function that will handle the "Download Progress". I have included one .. You can add more in the same script and call them as per your criteria. A simple one would look like:
Code: | DLPCE( WP=0, LP=0, MSG="" ) { Tooltip, Downloading : %WP% / %LP% } |
- F : Flags. Default is INTERNET_FLAG_RELOAD|INTERNET_FLAG_DONT_CACHE which makes sure file is not read from/written into cache.
Return Value & ErrorLevel:
If there are no errors from API functions, the function will return the Bytes Read, which will be exactly equal to the Variable's capacity.
If Bytes Read is lesser than the File/Content Length or If Bytes Read is equal to Requested Bytes, AHK ErrorLevel will be set to 1
On an API error, the function will return a negative number which can interpreted as follows:
-1 Internet Connection Problem
-2 Internet Connection Problem
-4 Length of file could not be ascertained
-5 The above and one of the Internet handles could not closed
-6 The above one more of the Internet handles could not closed
-7 One of the Internet handles could not closed
-8 Both of the the Internet handles could not closed
The included dynamic function DLP() will display a progress-bar
in the right-bottom for the screen:
|
|
|