Jump to content

Update checking with InetGetInfo()


Recommended Posts

Why doesn't the InetGetInfo() work correctly?

When @InetGetActive was in Autoit, it worked. But now it's problem with "InetGetInfo()"

In the helpfile it says that it should be an array. But it doesn't.

How can i fix it, too work?

;Check for update

$url = "http://upit.cc/images/79807efd.png"

$sizeCompare1 = filegetsize("update.dat")
$sizeCompare2 = inetgetsize($url,1)

if $sizeCompare2 > $sizeCompare1 Then

    ProgressOn("Update Check", "Downloading", "0 %")
    $download = inetget($url,"update.dat",1)
Else
    Exit
EndIf

; I had this code before. But it doesn't work longer, because @InetGetActive is InetGetInfo()
;
;While @InetGetActive
;
;   $fuu = @InetGetBytesRead / $size * 100
;   ProgressSet( floor($fuu), floor($fuu) & " %")
;   sleep(100)
;
;Wend

do

    sleep(100)

    $Data = InetGetInfo($download)
    $fuu = $data[0] / $sizeCompare2 * 100

    ProgressSet( floor($fuu), floor($fuu) & " %")

until InetGetInfo($Download, 2)


ProgressSet(100 , "Done", "Complete")
ProgressOff()
InetClose($sizeCompare1)
InetClose($sizeCompare2)
InetClose($download)
Link to comment
Share on other sites

Just thinking out loud, but wouldn't something like this be better than requesting the whole array:

$fuu = InetGetInfo($download) / $sizeCompare2 * 100
if @error then ConsoleWrite ("Error in download: " & InetGetInfo ($download, 4) & @LF)

Edited by Fulano

#fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja!

Link to comment
Share on other sites

Just thinking out loud, but wouldn't something like this be better than requesting the whole array:

$fuu = InetGetInfo($download) / $sizeCompare2 * 100
if @error then ConsoleWrite ("Error in download: " & InetGetInfo ($download, 4) & @LF)

Yeh, but i get nothing now. I don't know why.

Without the calculation and with.

The @InetGetBytesRead gave me x bytes readed before, and InetGetInfo() gives me nothing.

Edit:

I have fixed it now, added this instead. Works good. But not perfect.

$fuu = InetGetInfo($download, 0)

$down = floor($fuu / $sizeCompare2 * 100)

Edited by bobbby
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...