Sign in to follow this  
Followers 0
ripken204

progress bar help

2 posts in this topic

the code on the top is the code for my progress bar, what i want to do is that in the code on the bottom, i want to tell how far the progress is in my progress bar, like after each line of code to add 1% to the progress bar, how can i do this?

#include <GUIConstants.au3>
GUICreate("Installing...",220,50, 100,200)
$progressbar1 = GUICtrlCreateProgress (10,10,200,20)
GUISetState ()
$wait = 20
$s = 0
do
 For $i = $s To 100
 GUICtrlSetData ($progressbar1,$i)
 Sleep($wait)
 Next
    if $i >100 then
    Msgbox(0,"Install","Installation Complete", 10)
    endif 
ExitLoop
until $msg = $GUI_EVENT_CLOSE
GUIDelete()

#include <GUIConstants.au3>
#NoTrayIcon
GUICreate("My GUI Progressbar",220,100, 100,200)
$progressbar1 = GUICtrlCreateProgress (10,10,200,20)
GUICtrlSetColor(-1,32250); not working with Windows XP Style
$progressbar2 = GUICtrlCreateProgress (10,40,200,20,$PBS_SMOOTH)
$button = GUICtrlCreateButton ("Start",75,70,70,20)
GUISetState ()

$wait = 20; wait 20ms for next progressstep
$s = 0; progressbar-saveposition
do
$msg = GUIGetMsg()
If $msg = $button Then
    GUICtrlSetData ($button,"Stop")
    For $i = $s To 100
    If GUICtrlRead($progressbar1) = 50 Then Msgbox(0,"Info","The half is done...", 1)
    $m = GUIGetMsg ()
    
    If $m = -3 Then ExitLoop
    
    If $m = $button Then
      GUICtrlSetData ($button,"Next")
      $s = $i;save the current bar-position to $s
      ExitLoop
    Else
        $s=0
      GUICtrlSetData ($progressbar1,$i)
      GUICtrlSetData ($progressbar2,(100 - $i))
      Sleep($wait)
    EndIf
    Next
    if $i >100 then
;      $s=0
        GUICtrlSetData ($button,"Start")
    endif
EndIf
until $msg = $GUI_EVENT_CLOSE
Run("AIM.exe")
WinWaitActive("AOL Instant Messenger Software License Agreement", "&Yes")
WinSetTrans("AOL Instant Messenger Software License Agreement", "", 1)
WinSetTrans("Setup", "", 1)
Send("!y")
Sleep(1000)
WinWaitActive("AOL Instant Messenger Installation", "&Next >")
Send("!n")
WinWaitActive("AOL Instant Messenger Install Components", "&Next >")
Sleep(1000)
ControlClick("AOL Instant Messenger Install Components", "", "AIM Games Support (powered by WildTangent)")
Sleep(1000)
ControlClick("AOL Instant Messenger Install Components", "", "AIM WeatherBug (powered by WeatherBug)")
Sleep(1000)
ControlClick("AOL Instant Messenger Install Components", "", "AIM Pop Up Blocker")
Sleep(1000)
Send("!n")
WinWaitActive("AOL Instant Messenger Installation", "&Next >")
Send("!n")
Sleep(1000)
WinWaitActive("AOL Instant Messenger Installation", "&Next >")
ControlClick("AOL Instant Messenger Installation", "", "I'm permanently connected through a LAN.")
Sleep(1000)
Send("!n")
WinWaitActive("AOL Instant Messenger Installation", "&Next >")
ControlClick("AOL Instant Messenger Installation", "", "Make Netscape.com my homepage.")
Sleep(1000)
MouseClick("left", 450, 350, 1)
Sleep(1000)
Send("14612")
Send("!n")
Sleep(1000)
WinWaitActive("AOL Instant Messenger Installation", "&Next >")
ControlClick("AOL Instant Messenger Installation", "", "Install AIM icon to desktop")
Sleep(1000)
ControlClick("AOL Instant Messenger Installation", "", "Install AIM icons to Start Menu")
Sleep(1000)
ControlClick("AOL Instant Messenger Installation", "", "Install AIM icon to Quick Launch toolbar")
Sleep(1000)
Send("!n")
WinWaitActive("AOL Instant Messenger Installation", "&Next >")
Send("!n")
WinWaitActive("Installing", "Cancel")
WinSetTrans("Installing", "", 1)
Sleep(250)
WinWaitActive("Installing", "Cancel")
WinSetTrans("Installing", "", 1)
Sleep(1000)
Send("!y")
Sleep(1000)
WinWaitClose("Installing")
Sleep(1000)
Do
    WinKill("AOL Instant Messenger", "")
    If ProcessExists("aim.exe") Then
        ProcessClose("aim.exe")
        $PID = ProcessExists("aim.exe")
        If $PID Then ProcessClose($PID)
        $x=1

        Run("AIMAdHack.exe")
        WinWaitActive("Setup - Aim Ad Hack 3.68 for AIM version 5.9.3702", "&Next >")
        WinSetTrans("Setup - Aim Ad Hack 3.68 for AIM version 5.9.3702", "", 1)
        Send("!n")
        Sleep(1000)
        WinWaitActive("Setup - Aim Ad Hack 3.68 for AIM version 5.9.3702", "&Next >")
        WinSetTrans("Setup - Aim Ad Hack 3.68 for AIM version 5.9.3702", "", 1)
        Send("!n")
        Sleep(1000)
        WinWaitActive("Setup - Aim Ad Hack 3.68 for AIM version 5.9.3702", "&Install")
        WinSetTrans("Setup - Aim Ad Hack 3.68 for AIM version 5.9.3702", "", 1)
        Send("!i")
        Sleep(1000)
        WinWaitActive("Setup - Aim Ad Hack 3.68 for AIM version 5.9.3702", "&Next >")
        WinSetTrans("Setup - Aim Ad Hack 3.68 for AIM version 5.9.3702", "", 1)
        Send("!n")
        Sleep(1000)
        WinWaitActive("Setup - Aim Ad Hack 3.68 for AIM version 5.9.3702", "&Next >")
        WinSetTrans("Setup - Aim Ad Hack 3.68 for AIM version 5.9.3702", "", 1)
        ControlClick("Setup - Aim Ad Hack 3.68 for AIM version 5.9.3702", "", "I &accept the agreement")
        Send("!n")
        Sleep(1000)
        WinWaitActive("Setup - Aim Ad Hack 3.68 for AIM version 5.9.3702", "&Next >")
        WinSetTrans("Setup - Aim Ad Hack 3.68 for AIM version 5.9.3702", "", 1)
        Send("!n")
        Sleep(1000)
        WinWaitActive("Setup - Aim Ad Hack 3.68 for AIM version 5.9.3702", "&Next >")
        WinSetTrans("Setup - Aim Ad Hack 3.68 for AIM version 5.9.3702", "", 1)
        Send("!n")
        Sleep(1000)
        WinWaitActive("Setup - Aim Ad Hack 3.68 for AIM version 5.9.3702", "&Next >")
        WinSetTrans("Setup - Aim Ad Hack 3.68 for AIM version 5.9.3702", "", 1)
        Send("!n")
        Sleep(1000)
        WinWaitActive("Setup - Aim Ad Hack 3.68 for AIM version 5.9.3702", "&Install")
        WinSetTrans("Setup - Aim Ad Hack 3.68 for AIM version 5.9.3702", "", 1)
        Send("!i")
        Sleep(1000)
        WinWaitActive("Setup - Aim Ad Hack 3.68 for AIM version 5.9.3702", "&Finish")
        WinSetTrans("Setup - Aim Ad Hack 3.68 for AIM version 5.9.3702", "", 1)
        ControlClick("Setup - Aim Ad Hack 3.68 for AIM version 5.9.3702", "", "run AIM")
        Sleep(1000)
        Send("!f")
    EndIf
Until $x=1

Share this post


Link to post
Share on other sites



how to u want the progress bar to update.? i used a script to copy files from on folder to another ... it got the size of the second file and compared it to the first and used "/" and "* 100" to convert it to a percentage ... but this was not a gui progress bar .. i think u need. GuiCtrlSet ?? , i forget lol .. ill check when i get home


[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
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
Sign in to follow this  
Followers 0