Jump to content

progress bar


Recommended Posts

how do i make like a progress bar for % downloaded

here is my script, which is useless so far

ProgressOn("Loading Host Helper v1.0", "Loading Please Wait", "0 percent")

For $i = 1 to 100 step 43

sleep(100)

ProgressSet( $i, $i & " percent")

Next

ProgressSet(100 , "Done", "Host Helper Loaded")

sleep(500)

ProgressOff()

SoundPlay("C:\Windows\media\start.wav")

InetGet("http://maietweb.nefficient.com/maiet/GunzInternational_20050804.exe", "index.exe")

the loading thing dont work cuz its fake.

Link to comment
Share on other sites

First of all you have made a virtual progress....You have to first call the InetGet() and then call the ProgreesOn(). As for the progress update you should play with InetGetSize() and @InetGetBytesRead.... It is natural that current percentage complete is (@InetGetBytesRead\InetGetSize())*100....

Edited by hgeras
Link to comment
Share on other sites

First of all you have made a virtual progress....You have to first call the InetGet() and then call the ProgreesOn(). As for the progress update you should play with InetGetSize() and @InetGetBytesRead.... It is natural that current percentage complete is (@InetGetBytesRead\InetGetSize())*100....

<{POST_SNAPBACK}>

Didnt work here is what i got so far

InetGet("http://www.pc-defender.net/pc-defender.zip", "index.exe")

ProgressOn("Loading Host Helper v1.0", "Loading Please Wait", "0 percent")

For $i = 1 to 100 step "(@InetGetBytesRead\InetGetSize())*100"

next

sleep(1000)

ProgressSet"((@InetGetBytesRead\InetGetSize())*100" , "Done", "Host Helper Loaded")

ProgressOff()

SoundPlay("C:\Windows\media\start.wav")

it just freezes at -% and does nothing, though i thankyou for your time. BTW, im a noob :whistle: so new at this.

Link to comment
Share on other sites

I can see you are noob...Your approach is wrong...Totally... Try this and tell me if it works for ya cos i have never done something like this before....

$size=InetGetSize("http://www.pc-defender.net/pc-defender.zip")
sleep(5000)
InetGet("http://www.pc-defender.net/pc-defender.zip", "index.zip",0,1)
ProgressOn("Loading Host Helper v1.0", "Loading Please Wait", "")
While @InetGetActive
ProgressSet((@InetGetBytesRead/$size)*100)
sleep(500)
Wend
ProgressSet(100 , "Done", "Host Helper Loaded")
sleep(2000)
ProgressOff()
SoundPlay("C:\Windows\media\start.wav")

C ya

EDIT:Too many mistakes which i corrected them....

Edited by hgeras
Link to comment
Share on other sites

Ok, an alternative...

Suggestion: Read carefully your helpfile. :whistle:

$sURL = "http://maietweb.nefficient.com/maiet/GunzInternational_20050804.exe"
$sLocalFile = "index.exe"

ProgressOn("Loading Host Helper v1.0", "Searching file...(Please Wait)", "0%", 5, -1, 16 )
$fSize = InetGetSize( $sURL ); looking the size before to start

ProgressSet( 0, '0%', "Loading file...(Please wait)")
InetGet( $sURL, $sLocalFile, 0, 1); request the file

; Downloading process
While @InetGetActive
    $bytesR = @InetGetBytesRead;macro reading the progress
    $bPercent = Round(($bytesR / $fSize) * 100)
    ProgressSet( $bPercent, $bPercent  & "% ( " & Round($bytesR/1024) & 'kb / '  & Round($fSize/1024) & 'kb )', 'Downloading "' & $sLocalFile& '"...')
    Sleep(100); to reduce the flickering
WEnd
ProgressOff()
SoundPlay("C:\Windows\media\start.wav")
MsgBox(0, "", "Download succesful!" )
Link to comment
Share on other sites

As you can see Josbe's code and mine do the same thing...Josbe's is more "professional". But you can start studying mine which is simpler and then Josbe's to get a wider view of AutoIt structure.... And as Josbe mentioned...Read carefully the Help File....It is perfect and not many questions should arise if properly and focused read.....

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...