ReaImDown Posted December 28, 2007 Share Posted December 28, 2007 I need help with making a progress bar, I want to install a couple different files using a GUI and would like the user to know which file is being installed, and how much progress has been made... EX. the progress bar's info would be using (out of 100%) $a = Filegetsize("a") $b = Filegetsize("b") $c = Filegetsize("c") $d = Filegetsize("d") $TotalSize = $a + $b + $c + $d [u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u] Link to comment Share on other sites More sharing options...
ReaImDown Posted December 29, 2007 Author Share Posted December 29, 2007 plz help lol sorry, please tell me if I was unclear. [u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u] Link to comment Share on other sites More sharing options...
Swift Posted December 29, 2007 Share Posted December 29, 2007 sorry i cant help...i tried creating a progress bar before...didnt work out all i got was errors..or a blank one...i belive you have to $prog = GUICreateProgress then... GuiSetData($1+$2+$3+$4, $prog) im pretty sure that'll work...correct me if im wrong Link to comment Share on other sites More sharing options...
JustinReno Posted December 29, 2007 Share Posted December 29, 2007 No, that is wrong. Link to comment Share on other sites More sharing options...
ReaImDown Posted December 29, 2007 Author Share Posted December 29, 2007 No, that is wrong.theres room for elaboration there [u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u] Link to comment Share on other sites More sharing options...
JustinReno Posted December 29, 2007 Share Posted December 29, 2007 GuiSetData($1+$2+$3+$4, $prog)GuiSetData isn't even a function. And if it was, the syntax is wrong in so many ways. Link to comment Share on other sites More sharing options...
Swift Posted December 29, 2007 Share Posted December 29, 2007 GUICtrlSetData? Link to comment Share on other sites More sharing options...
JustinReno Posted December 29, 2007 Share Posted December 29, 2007 That is a function. Link to comment Share on other sites More sharing options...
ReaImDown Posted December 29, 2007 Author Share Posted December 29, 2007 That is a function.lol can ya help please? [u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u] Link to comment Share on other sites More sharing options...
JustinReno Posted December 29, 2007 Share Posted December 29, 2007 GuiCtrlSetData($Progress, 25) GuiCtrlSetData($Progress, 50) GuiCtrlSetData($Progress, 75) GuiCtrlSetData($Progress, 100) Link to comment Share on other sites More sharing options...
ReaImDown Posted December 29, 2007 Author Share Posted December 29, 2007 GuiCtrlSetData($Progress, 25)GuiCtrlSetData($Progress, 50)GuiCtrlSetData($Progress, 75)GuiCtrlSetData($Progress, 100)hmmm, that means I would have to update it after every file is uploaded, and it wouldn't run smooth [u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u] Link to comment Share on other sites More sharing options...
JustinReno Posted December 29, 2007 Share Posted December 29, 2007 Its impossible for it to run smooth then. Link to comment Share on other sites More sharing options...
ReaImDown Posted December 29, 2007 Author Share Posted December 29, 2007 (edited) Its impossible for it to run smooth then.wrong type of progress, and I dont know where I got this link from...but... here http://www.autoitscript.com/forum/index.ph...st&id=11570that one updates okay Edited December 29, 2007 by ReaImDown [u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u] Link to comment Share on other sites More sharing options...
ReaImDown Posted December 29, 2007 Author Share Posted December 29, 2007 any way of turning that coding into a progress bar? [u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u] Link to comment Share on other sites More sharing options...
Emiel Wieldraaijer Posted December 30, 2007 Share Posted December 30, 2007 Use AdlibEnable to run a function in the background which updates the progressbar Look at my first post in http://www.autoitscript.com/forum/index.php?showtopic=60232 for an example .. Best regards,Emiel Wieldraaijer Link to comment Share on other sites More sharing options...
ReaImDown Posted December 30, 2007 Author Share Posted December 30, 2007 (edited) Use AdlibEnable to run a function in the background which updates the progressbar Look at my first post in http://www.autoitscript.com/forum/index.php?showtopic=60232 for an example ..thank you, thank you heres a useless program I just made CODE#include <GUIConstants.au3>$begin = TimerInit() $a = 0 $b = 0 $c = 0$x = 0Global $Form1 = GUICreate("Form1", 633, 447, 193, 125)Global $test = GUICtrlCreateProgress(128, 360, 329, 25)Global $time = GUICtrlCreateLabel("",128, 280, 329,25)GUICtrlSetColor(-1, 0x00FF00)GUICtrlSetBkColor(-1, 0x000000)Global $Label1 = GUICtrlCreateLabel("0%", 128, 320, 34, 17)GUISetState(@SW_SHOW)do $x = $x +(Random(-50,50)) Sleep(100) AdlibEnable("Mine",10)until $x >= 1000MsgBox(0, "Total Time", "The program took " & $totaltime & " to get to " & $percent & "%")Func Mine()$dif = TimerDiff($begin) $d = Int($dif / 1000) if $d = 60 Then $begin = TimerInit() $c = $c + 1 EndIf if $c = 60 Then $c = 0 $b = $b +1 EndIf if $b = 24 Then $b = 0 $a = $a +1 EndIf Global $totaltime = $a & " Days, " & $b & " Hours, " & $c & " Minutes, " & $d & " Seconds." GUICtrlSetData($time,$totaltime) global $percent = Int( ($x * 100) / 1000 ) GUICtrlSetData($Label1, $percent & "%") GUICtrlSetData($test,$percent)EndFunc Edited December 30, 2007 by ReaImDown [u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u] Link to comment Share on other sites More sharing options...
ReaImDown Posted December 30, 2007 Author Share Posted December 30, 2007 (edited) hmmm, I need help figuring out $x $x would be the % already copied to @DesktopDir & "\New Folder") CODEGUICreate("Tester", 400,400) $P = GUICtrlCreateProgress(1,100,300,15) AdlibEnable(Tracker,100) global $f = FileGetSize("New Text document.txt") FileCopy("New Text document.txt", @DesktopDir & "\New Folder") Func Tracker() global $percent = Int( ($x * 100) / $f ) GUICtrlSetData($P, $percent) EndFunc Edited December 30, 2007 by ReaImDown [u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u] Link to comment Share on other sites More sharing options...
ReaImDown Posted December 31, 2007 Author Share Posted December 31, 2007 Bump [u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u] Link to comment Share on other sites More sharing options...
MrCreatoR Posted December 31, 2007 Share Posted December 31, 2007 Hi, Here is an example on Progress Simulation (can be used as template for copying files) ... expandcollapse popup#include <GuiConstants.au3> $Gui = GuiCreate("Simulation Progress Demo", 350, 120) $ProgressLabel = GUICtrlCreateLabel("Status: Press the button! ;)", 20, 30, 330) $Progress = GUICtrlCreateProgress(20, 50, 300, 20) $StartButton = GUICtrlCreateButton("Start Simulation Progress", (350/2)-(140/2), 80, 140) GUISetState() While 1 $Msg = GUIGetMsg() Switch $Msg Case -3 Exit Case $StartButton GUICtrlSetData($ProgressLabel, "Status: Please wait...") Dim $FilesArr[1000] For $i = 1 To UBound($FilesArr)-1 $FilesArr[$i] = _GetRandomName(6) & ".test" Next Local $FilesCount = UBound($FilesArr)-1 Local $CurrentFName, $ProgressSet = 0 GUICtrlSetData($ProgressLabel, "Status: 0% Done...") GUICtrlSetData($StartButton, "Abort Simulation Progress") For $i = 1 To $FilesCount Sleep(40) $CurrentFName = $FilesArr[$i] $ProgressSet = Round(100 / ($FilesCount / $i)) GUICtrlSetData($ProgressLabel, "Status: " & $ProgressSet & "% Done, [" & $CurrentFName & "]") GUICtrlSetData($Progress, $ProgressSet) If GUIGetMsg() = $StartButton Then ExitLoop Next GUICtrlSetData($Progress, 0) GUICtrlSetData($ProgressLabel, "Status: Finish!") GUICtrlSetData($StartButton, "Start Simulation Progress") EndSwitch WEnd Func _GetRandomName($Lenght=3) Local $RetName = '' For $i = 1 To $Lenght $RetName &= Chr(Random(97, 122, 1)) Next Return $RetName EndFunc Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now