gcue Posted May 7, 2008 Share Posted May 7, 2008 does anyone have any ideas for a true progressbar? one that actually looks like it matches up with the process wait? Link to comment Share on other sites More sharing options...
James Posted May 7, 2008 Share Posted May 7, 2008 What do you mean "true" progress bar? The GUICtrlCreateProgress() is a progress bar. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
MikeP Posted May 7, 2008 Share Posted May 7, 2008 (edited) He means he's running a process and want his progress bar to match the evolution of his process. 0% done at the start of the process.. 100% done when process is over. And obviously we can't answer since we don't know what he wants his progress bar to be in relation with... It's up to him to check how far he is in his process execution and pass the info to the progress bar... Example.. your process = a function that copy a directory to another directory your check function = compare source directory size to (current) destination directory size.. once both match.. progress = 100% and in-between... up to you if want your progress bar to jump by 1% .. 10% .. 20% .. and the impact this check function would have on your script efficiency.. checking every milliseconds would be dumb for example.. every second is much better. Edited May 7, 2008 by MikeP Link to comment Share on other sites More sharing options...
James Posted May 7, 2008 Share Posted May 7, 2008 Oh, well by the time it's executed then it would be full. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
weaponx Posted May 7, 2008 Share Posted May 7, 2008 (edited) Yea its not going to happen. How would a progressbar for ProcessWait() even be useful? The whole purpose of ProcessWait() is to stop your script because it has no idea when the process will start, therefore you have no metric to use for the progress. EDIT: 3000th post and all I got was this crappy t-shirt Edited May 7, 2008 by weaponx Link to comment Share on other sites More sharing options...
MikeP Posted May 7, 2008 Share Posted May 7, 2008 (edited) Oh, well by the time it's executed then it would be full.Ahah EDIT: 3000th post and all I got was this crappy t-shirtCongratz weaponx ! (and this is priceless ! worth more than a t-shirt) Edited May 7, 2008 by MikeP Link to comment Share on other sites More sharing options...
spudw2k Posted May 7, 2008 Share Posted May 7, 2008 I've found that sometimes (when creating something that users will see) it's nice to show at least an animated progressbar to show that "something is happening." Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
MikeP Posted May 7, 2008 Share Posted May 7, 2008 You're right.. using fake progress bar can be useful and ergonomic.. there's nothing worse than wondering if the script is actually running or not, finished or not. Link to comment Share on other sites More sharing options...
gcue Posted May 7, 2008 Author Share Posted May 7, 2008 then how about a bar that scrolls from left to right and says "checking" know what i mean? i think that would be less misleading.. how would that be coded? Link to comment Share on other sites More sharing options...
MikeP Posted May 7, 2008 Share Posted May 7, 2008 ProgressOn , in your Help file of Autoit : 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() Link to comment Share on other sites More sharing options...
weaponx Posted May 7, 2008 Share Posted May 7, 2008 There is no universal measure of progress. When you create a progress bar it should visually represent a step in your code. Say you have 10 steps in your code, you might add 10% after each step to achieve 100%. The same goes for file copying. Say you have 100 files, if you need to see the progress in terms of number of files copied, each file equals 1%. File 1 copy...1% File 2 copy...2% ... File 99 copy...99% File 100 copy...100% If you need to see progress in terms of bytes copied, each file is a fraction of the total size of all files combined. Total filesize = 100 bytes File 1 copy (50 bytes)...50% File 2 copy (25 bytes)...75% File 3 copy (20 bytes)...95% File 4 copy (5 bytes)...100% Link to comment Share on other sites More sharing options...
ProgAndy Posted May 7, 2008 Share Posted May 7, 2008 Something like this? Found it between my Scripts expandcollapse popup_ProcessWaitProgress("taskmgr.exe") ;=============================================================================== ; ; Function Name: _ProcessWaitProgress($Process,$timeout = -1, $speed = 1) ; Description:: Shows an Progressbar while Waiting on a Process ; Parameter(s): $Process - PID or Name of Process ; $timeout - Timeout in Seconds, -1 (Default): No TimeOut ; $speed - Speed of moving Progressbar ; Requirement(s): ?? ; Return Value(s): 1, if success, o and @error=1 If TimeOUt ; Author(s): Prog@ndy ; ;=============================================================================== ; Func _ProcessWaitProgress($Process,$timeout = -1, $speed = 1) Local $perc = 0, $dir = 1, $elapsed, $tim ProgressOn("Waiting for Process","Waiting for "& $Process,"Waiting for TaskMgr starting") $tim = TimerInit() While 1 $perc += $speed*$dir if $perc >= 100 Then $dir = -1 ElseIf $perc <= 0 Then $dir = 1 EndIf $elapsed = Round(TimerDiff($tim)/1000) ProgressSet($perc,"Elapsed time: " & $elapsed & "s") If ProcessExists($Process) Then ExitLoop If $timeout > 0 And $elapsed >= $timeout Then ProgressOff() Return SetError(1,0,0) EndIf Sleep(50) WEnd ProgressOff() Return 1 EndFunc *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
weaponx Posted May 7, 2008 Share Posted May 7, 2008 The progressbar serves no purpose here. A traytip or popup window thats says "Waiting for process..." and a time counter would suffice, since the time can be zero to infinity an open ended counter is best. Link to comment Share on other sites More sharing options...
ofLight Posted May 7, 2008 Share Posted May 7, 2008 Another option for an open ended Progressbar is to use the $PBS_MARQUEE = 0x00000008. This to me gives the obvious visual result of an open ended Wait process. There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly Link to comment Share on other sites More sharing options...
gcue Posted May 7, 2008 Author Share Posted May 7, 2008 (edited) do you guys know what i mean? a progressbar that goes to 100% then back to 0% then back to 100% then back to 0% (till the task completes) of course not displaying the %s.. this would just show that theres activity in the background. Edited May 7, 2008 by gcue Link to comment Share on other sites More sharing options...
weaponx Posted May 7, 2008 Share Posted May 7, 2008 do you guys know what i mean?a progressbar that goes to 100% then back to 0% then back to 100% then back to 0% (till the task completes)of course not displaying the %s.. this would just show that theres activity in the background.Ummm...thats exactly what ProgAndy posted for you. Link to comment Share on other sites More sharing options...
James Posted May 7, 2008 Share Posted May 7, 2008 $PBS_MARQUEE Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
gcue Posted May 7, 2008 Author Share Posted May 7, 2008 doh!i had type up my post and hadnt seen his post by the time i submitted.thanks manUmmm...thats exactly what ProgAndy posted for you. Link to comment Share on other sites More sharing options...
MikeP Posted May 7, 2008 Share Posted May 7, 2008 I would like to congratulate ProgAndy. For what ? for understanding what the thread maker was meaning .. before his "do you guys know what I mean?" post ... gj andy !!! Link to comment Share on other sites More sharing options...
ResNullius Posted May 7, 2008 Share Posted May 7, 2008 (edited) Here's another take on this, combining something RazerM did ( http://www.autoitscript.com/forum/index.ph...st&p=370254 ) with the concept of ProgAndyI combined some of RazerM's seperated functions into the main loop.expandcollapse popup;original progress concept by RazerM, based on googemyster ;http://www.autoitscript.com/forum/index.php?s=&showtopic=48977&view=findpost&p=370254 _ProcessWaitProgress("taskmgr.exe", "Waiting For Taskmanager...", 10, 2) Func _ProcessWaitProgress($process, $sLabelCaption = "", $timeout = 0, $speed = 1) ;Usage: _ProcessWaitProgress($process, $caption, $timeout, $speed) ;Returns 1 on Progress Started, 0 on timeout with @error set to 1 $GuiCloseMode = Opt("GUICloseOnESC", 0) ;get & set Esc Close Mode #include <GUIConstants.au3> Local $aLabel[50], $Ca, $Da, $elapsed, $tim Local $backClr = 0xFFFFFF ;white, Local $foreClr = 0x009A31;green ;0xFF0000 red Local $aColors = _ColorGradient($backClr, $foreClr, 50) $Ca = GUICreate("", 250, 46, -1, -1, $WS_POPUP, $WS_EX_TOPMOST + $WS_EX_WINDOWEDGE + $WS_EX_DLGMODALFRAME) GUISetBkColor(0x000000, $Ca) $Da = GUICtrlCreateLabel($sLabelCaption, 23, 1, 250, 23) ; $SS_CENTER) GUICtrlCreateGraphic(-1, 1, 252, 45, $SS_SUNKEN) GUICtrlSetColor(-1, 0XFFFFFF) GUICtrlSetColor($Da, 0XFFFFFF) GUICtrlSetFont($Da, "10", "50");, "", "Palatino LinoType Italic") GUISetState(@SW_SHOW) GUICtrlCreateGraphic(1, 23, 250, 20) For $i = 0 To 245 Step 5 ;we divide i by 5 because of step 5. 0/5 = 0, 5/5 = 1, 10/5 = 2 $aLabel[$i / 5] = GUICtrlCreateLabel("", $i, 25, 4, 16) Next $tim = TimerInit() While Not ProcessExists($process) ;SlideRight For $m = 0 To 245 Step 5 GUICtrlSetBkColor($aLabel[$m / 5], $aColors[$m / 5]) Sleep(50/$speed) $elapsed = Round(TimerDiff($tim) / 1000) If ProcessExists($process) Or ($timeout > 0 And $elapsed >= $timeout) Then $ReturnVal = _ExitFunc($timeout, $elapsed) SetError(@error) Opt(Opt("GUICloseOnESC", $GuiCloseMode) Return ($ReturnVal) EndIf Next _getmsg() ;SlideLeft For $m = 245 To 0 Step -5 GUICtrlSetBkColor($aLabel[$m / 5], $aColors[49 - $m / 5]) ;49- so that colours are opposite from _Slider Right colours Sleep(50/$speed) $elapsed = Round(TimerDiff($tim) / 1000) If ProcessExists($process) Or ($timeout > 0 And $elapsed >= $timeout) Then $ReturnVal = _ExitFunc($timeout, $elapsed) SetError(@error) Opt(Opt("GUICloseOnESC", $GuiCloseMode) Return ($ReturnVal) EndIf Next _getmsg() WEnd EndFunc ;==>_ProcessWaitProgress Func _ExitFunc($timeout, $elapsed) If $timeout > 0 And $elapsed >= $timeout Then Return SetError(1, 0, 0) EndIf Return 1 EndFunc ;==>_ExitFunc Func _getmsg() $Msg = GUIGetMsg() If $Msg = $GUI_EVENT_CLOSE Then Exit ;put something to stop progressbar EndFunc ;==>_getmsg ;this function was written by CoePSX Func _ColorGradient($hInitialColor, $hFinalColor, $iReturnSize) $hInitialColor = Hex($hInitialColor, 6) $hFinalColor = Hex($hFinalColor, 6) Local $iRed1 = Dec(StringLeft($hInitialColor, 2)) Local $iGreen1 = Dec(StringMid($hInitialColor, 3, 2)) Local $iBlue1 = Dec(StringMid($hInitialColor, 5, 2)) Local $iRed2 = Dec(StringLeft($hFinalColor, 2)) Local $iGreen2 = Dec(StringMid($hFinalColor, 3, 2)) Local $iBlue2 = Dec(StringMid($hFinalColor, 5, 2)) Local $iPlusRed = ($iRed2 - $iRed1) / ($iReturnSize - 1) Local $iPlusBlue = ($iBlue2 - $iBlue1) / ($iReturnSize - 1) Local $iPlusGreen = ($iGreen2 - $iGreen1) / ($iReturnSize - 1) Dim $iColorArray[$iReturnSize] For $i = 0 To $iReturnSize - 1 $iNowRed = Floor($iRed1 + ($iPlusRed * $i)) $iNowBlue = Floor($iBlue1 + ($iPlusBlue * $i)) $iNowGreen = Floor($iGreen1 + ($iPlusGreen * $i)) $iColorArray[$i] = Dec(Hex($iNowRed, 2) & Hex($iNowGreen, 2) & Hex($iNowBlue, 2)) Next Return $iColorArray EndFunc ;==>_ColorGradient Edited May 7, 2008 by ResNullius 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