Jump to content

Loading Progress


jerwin
 Share

Recommended Posts

can anyone can give me Loading Progress script for GUI that when i click start it the progress will load up to 100% then the script for start will execute...

thanx in advance...

[font="Arial Black"]Looking for a partner in making Perfect Bot for DEKARONPm me if you wanna join.....[/font]
Link to comment
Share on other sites

Well depends on what your script is doing in the background. If you want to make just a loading bar, then really, I see no point in it, and really 30seconds in the helpfile for ProgressOn is all you need. :P

Also, you signature is way too long. Makes me have to scroll more than i want too :P Please shorten it.

Link to comment
Share on other sites

Well depends on what your script is doing in the background. If you want to make just a loading bar, then really, I see no point in it, and really 30seconds in the helpfile for ProgressOn is all you need. :P

Also, you signature is way too long. Makes me have to scroll more than i want too :P Please shorten it.

sorry about my signature....

heres my progress bar....

ProgressOn("Progress Meter", "Increments every second", "0 percent")
For $i = 10 to 100 step 10
    sleep(1000)
    ProgressSet( $i, $i & " percent")
Next
ProgressSet(100 , "Done", "Complete")
sleep(500)
ProgressOff()

but i want it to be like this.........

Posted Image

after loading the real gui will show have an idea how to do it???

[font="Arial Black"]Looking for a partner in making Perfect Bot for DEKARONPm me if you wanna join.....[/font]
Link to comment
Share on other sites

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$pic = @ScriptDir & "\Screenie.jpg" 
$i = 1
$timestamp = TimerInit()
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("AForm1", 460, 326, 193, 115)
$Pic1 = GUICtrlCreatePic($pic, 0, 0, 460, 300, BitOR($SS_NOTIFY, $WS_GROUP))
$Progress1 = GUICtrlCreateProgress(2, 304, 456, 17)
GUICtrlSetData(-1, $i)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case TimerDiff($timestamp) < 20
            $timestamp = TimerInit()
            $i += 1
            If $i > 100 Then $i = 0
            GUICtrlSetData($Progress1, $i)
    EndSwitch
WEnd

You will need the picture:

post-16404-1218092697_thumb.jpg

Link to comment
Share on other sites

Sorry For Triple Post-

ahmm sir.. the loading dont have end... :P

i wait for 5 mins but still the gui is loading...

[font="Arial Black"]Looking for a partner in making Perfect Bot for DEKARONPm me if you wanna join.....[/font]
Link to comment
Share on other sites

Course it doesn't end.... I did that on purpose. You need to study the code, work out how it works (It's a just a Basic GUI...)

Depending on what you are loading, you can set the progress... GUICtrlSetData ($Progress1, ammount...)

I must add, I will not give it to you on a silver platter. I was hoping you would take the time to work out what I did, but obviously I was wrong....

Link to comment
Share on other sites

Allright, I'll comment the script, and tell you exactly what we're doing... :P

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$pic = @ScriptDir & "\Screenie.jpg"; This is the path to the image.
$i = 1; initial value for the progress
$timestamp = TimerInit(); start the timer- ONLY NEEDED FOR THIS EXAMPLE
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("AForm1", 460, 326, 193, 115); Create The GUI
$Pic1 = GUICtrlCreatePic($pic, 0, 0, 460, 300, BitOR($SS_NOTIFY, $WS_GROUP)); Create the picture control, and set the pic to what we told it to have earlier.
$Progress1 = GUICtrlCreateProgress(2, 304, 456, 17); Create the progress control
GUICtrlSetData(-1, $i);Set the progress to the inital value we set earlier
GUISetState(@SW_SHOW);Show the GUI
#EndRegion ### END Koda GUI section ###

While 1;Start loop
    $nMsg = GUIGetMsg();Get the messages from the gui (Events- like button clicks etc.)
    Switch $nMsg;Switch $nMsg.  A switch conditionally runs statements.
        Case $GUI_EVENT_CLOSE; If the Big Red X is pressed....
            Exit            ; ... Then Exit
        Case TimerDiff($timestamp) < 20; If the timer is more than 20ms, change the progress.  This is only for out example
            $timestamp = TimerInit(); Reset the timer
            $i += 1; Increase the value of what we're setting the progress to 
            If $i > 100 Then $i = 0; If it is more than 100, then set it to be 0 again.
            GUICtrlSetData($Progress1, $i); Set the progress
    EndSwitch
WEnd

And here is a different example of setting the progress bar.

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <Misc.au3>
$i = 1; Set the initial value of the progress

$Form1 = GUICreate("AForm1", 460, 326, 193, 115); Create The GUI
$Progress1 = GUICtrlCreateProgress(2, 304, 456, 17); Create the progress control
GUICtrlSetData(-1, $i);Set the progress to the inital value we set earlier
GUISetState(@SW_SHOW);Show the GUI
#EndRegion ### END Koda GUI section ###

While 1;Start loop
    $nMsg = GUIGetMsg();Get the messages from the gui (Events- like button clicks etc.)
    Select
        Case $nMsg = $GUI_EVENT_CLOSE; If the Big Red X is pressed....
            Exit ; ... Then Exit
        Case _IsPressed("26") = 1; If Up Arrow is pressed
            Do; Do The following until we release the key
                Sleep(50); Sleep so we don't increment the slider too fast
                $i += 1; Increase the value by 1
                If $i > 100 Then $i = 100; If it = 100 then keep it at 100
                GUICtrlSetData($Progress1, $i);Set the progress
            Until _IsPressed("26") = 0; Testing if the key is released
        Case _IsPressed("28") = 1; If Down Arrow is pressed
            Do; Do The following until we release the key
                Sleep(50); Sleep so we don't increment the slider too fast
                $i -= 1; Decrease the value by 1
                If $i < 0 Then $i = 0; If it is less than 0, then keep it at 0 
                GUICtrlSetData($Progress1, $i); Set the Progress
            Until _IsPressed("28") = 0; Testing if the key is released
    EndSelect
WEnd

Cheers,

Brett

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