Jump to content

progress bar help


Recommended Posts

I'm trying to run a installer application and while this installer is running I want a Gui to popup with a progress bar the progress bar doesn't have to mean any thing just continuously move across the Gui screen as long as the installer program is running. I have built progress bars before were the bar moved as the script executed each function in the script but for the life of me I can't see to get this work. here is my code so far any help would be appreciated.

#Region ### START Koda GUI section ### Form=c:\scripts\recoverycontinue.kxf
$Formcontinue = GUICreate("test", 355, 180, 333, 225)
$Yes = GUICtrlCreateButton("Yes", 64, 136, 75, 25, 0)
$No = GUICtrlCreateButton("No", 224, 136, 75, 25, 0)
$Label1 = GUICtrlCreateLabel("Click Yes to start", 24, 96, 316, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("this computer ", 32, 8, 295, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Label3 = GUICtrlCreateLabel("To blah ", 72, 32, 204, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Label4 = GUICtrlCreateLabel("goaway", 48, 64, 266, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
#EndRegion ### END Koda GUI section ###


#Region ### START Koda GUI section ### Form=c:\Scripts\progress.kxf
$Formprogress = GUICreate("Form1", 406, 257, 303, 219)
$Label1 = GUICtrlCreateLabel("Gary busey is working his magic", 128, 184, 154, 17)
$Progress1 = GUICtrlCreateProgress(16, 208, 374, 41)
$Pic1 = GUICtrlCreatePic("C:\scripts\GBprogress.jpg", 0, 0, 404, 180, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
#EndRegion ### END Koda GUI section ###Func Continue1()

$varloc= "c:\scripts\installer.exe"
$varapp= (@ComSpec & " /c " & $varapp, "", @SW_HIDE)


Func Continue1()
    GUISetState (@SW_SHOW, $Formcontinue)
While 1
    $nMsg = GUIGetMsg()
    If $nMsg=-3 Then Exit
    If $nMsg=$No then Exit
    If $nMsg=$Yes then Yes1()
            Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Main()
    EndSwitch
WEnd
EndFunc

Func Yes1()
        GUISetState(@SW_HIDE, $Formcontinue)
        GUISetState(@SW_SHOW, $Formprogress) 
    Run $varapp 
    While $varapp
        GUICtrlSetData($progress1, )
        
            
  EndFunc
Link to comment
Share on other sites

  • Moderators

scubasteve1281,

If you are not interested in the timing aspect of the progress and only want an indication that something is happening, use a marquee style like this:

#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <SendMessage.au3>

$hGUI = GUICreate("Test", 500, 500)
GUICtrlCreateProgress(10, 10, 400, 20, $PBS_MARQUEE)
_SendMessage(GUICtrlGetHandle(-1), $PBM_SETMARQUEE, True, 50) ; final parameter is update time in ms
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

I hope it does what you want. :D

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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