Paulie Posted April 25, 2006 Posted April 25, 2006 OK i Have a program that makes a progress bar and uses the code For $i = 10 to 100 step 3 sleep(1000) ProgressSet( $i, $i & "%") To display a progress reading of whatever percent it is finished However, it has to go up in regular intervals. I would like it to go by maybe a random number between 1 and 7 that changes each jump so it goes from 10% to 14% then maybe 20% then 23% with just random numbers. Also, is there a way without GUI to make the main text on a progress bar change like make it change reads Drive C: Drive D: Drive E: Drive F: Saved Files Hidden Documents Stuff like that. is it possible? TY
Moderators SmOke_N Posted April 25, 2006 Moderators Posted April 25, 2006 OK i Have a program that makes a progress bar and uses the code For $i = 10 to 100 step 3 sleep(1000) ProgressSet( $i, $i & "%") To display a progress reading of whatever percent it is finished However, it has to go up in regular intervals. I would like it to go by maybe a random number between 1 and 7 that changes each jump so it goes from 10% to 14% then maybe 20% then 23% with just random numbers. Also, is there a way without GUI to make the main text on a progress bar change like make it change reads Drive C: Drive D: Drive E: Drive F: Saved Files Hidden Documents Stuff like that. is it possible? TYDoesn't sound like a very accurate progressbar... Are you downloading something, reading a file out of an array, what exactly is the progressbar for? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Paulie Posted April 25, 2006 Author Posted April 25, 2006 what exactly is the progressbar for?Well its a program that makes a phoney progress bar that acts that... Well hers my code opt("WinTitleMatchMode",4) WinMinimizeAll() WinSetState("Classname=Shell_TrayWnd", "", @SW_HIDE) WinSetState("Program Manager", "", @SW_HIDE) ;******************************************* Beep (300,2000) $answer1 = Msgbox (48, "Crital Error", "Error #1143396- A critical error has occured. Wiping physical memory") If $answer1=1 Then Blockinput(1) ProgressOn("Physical Memory Dump","Dumping Physical Memory...","Dumping...") For $i = 10 to 100 step 3 sleep(1000) ProgressSet( $i, $i & "%") Next Blockinput(0) ProgressSet(100 , "Done", "Complete") sleep(500) ProgressOff() MsgBox(0, "Dump Complete", "Dump Completed, all files restored") Sleep(1000) WinMinimizeAllUndo() WinSetState("Classname=Shell_TrayWnd", "", @SW_SHOW) WinSetState("Program Manager", "", @SW_SHOW) endIf Its just fake, But i wanna make the bar look more realistic than just going up by 3s
Moderators SmOke_N Posted April 25, 2006 Moderators Posted April 25, 2006 Try this:ProgressOn("Physical Memory Dump","Dumping Physical Memory...","Dumping...") Local $x = 0 For $i = 1 to 100 $x = $x + Random(1, 7, 1) Sleep(Random(100, 500)) ProgressSet($i + $x, ($i + $x) & "%") If $i + $x >= 100 Then ExitLoop Next ProgressOff() Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Paulie Posted April 26, 2006 Author Posted April 26, 2006 Try this:ProgressOn("Physical Memory Dump","Dumping Physical Memory...","Dumping...") Local $x = 0 For $i = 1 to 100 $x = $x + Random(1, 7, 1) Sleep(Random(100, 500)) ProgressSet($i + $x, ($i + $x) & "%") If $i + $x >= 100 Then ExitLoop Next ProgressOff() Thank you very much, thats exactly what I needed, is there a way to make the main message change so it goes underneath "Dumpin Physical Memory" and says like "Current drive - C:" and have it change to D: and E: and F: or something like that, or does that need GUI
Moderators SmOke_N Posted April 26, 2006 Moderators Posted April 26, 2006 ProgressOn("Physical Memory Dump","Dumping Physical Memory...","Dumping...") Local $x = 0, $Drive[5] = ['', 'C:\', 'D:\', 'E:\', 'F:\'], $Percent[4] = ['', '40', '65', '85'], $Finished[5] = ['', 0, 0, 0, 0] Local $Store = @CRLF & 'Current Drive: ' & $Drive[1] For $i = 1 to 100 $x = $x + Random(1, 7, 1) Sleep(Random(100, 1500)) If $i + $x >= 100 Then ExitLoop ProgressSet($i + $x, ($i + $x) & "%" & $Store) If $i + $x <= $Percent[2] And $i + $x > $Percent[1] And $Finished[2] = 0 Then $Store = @CRLF & 'Current Drive: ' & $Drive[2] $Finished[2] = 1 ElseIf $i + $x <= $Percent[3] And $i + $x > $Percent[2] And $Finished[3] = 0 Then $Store = @CRLF & 'Current Drive: ' & $Drive[3] $Finished[3] = 1 ElseIf $i + $x > $Percent[3] And $Finished[4] = 0 Then $Store = @CRLF & 'Current Drive: ' & $Drive[4] $Finished[4] = 1 EndIf Next ProgressSet('100%', 'Memory Dump Completed', 'Finished') Sleep(4000) ProgressOff() Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
slightly_abnormal Posted April 26, 2006 Posted April 26, 2006 how do you get the progress inside of a gui window?, that'd be cool to add a cancel, pause, minimize buttons to it..
slightly_abnormal Posted April 26, 2006 Posted April 26, 2006 something like this.. expandcollapse popup#include <GUIConstants.au3> GUICreate("Progress",400,200) $cancel= GUICtrlCreateButton("Cancel",70,140,80,30) $pause= GUICtrlCreateButton("Pause",160,140,80,30) $minimize= GUICtrlCreateButton("Minimize",250,140,80,30) GUISetState() ProgressOn("Physical Memory Dump","Dumping Physical Memory...","Dumping...",-1,-1,1+2+16) Local $x = 0, $Drive[5] = ['', 'C:\', 'D:\', 'E:\', 'F:\'], $Percent[4] = ['', '40', '65', '85'], $Finished[5] = ['', 0, 0, 0, 0] Local $Store = @CRLF & 'Current Drive: ' & $Drive[1] For $i = 1 to 100 $x = $x + Random(1, 7, 1) Sleep(Random(100, 1500)) If $i + $x >= 100 Then ExitLoop ProgressSet($i + $x, ($i + $x) & "%" & $Store) If $i + $x <= $Percent[2] And $i + $x > $Percent[1] And $Finished[2] = 0 Then $Store = @CRLF & 'Current Drive: ' & $Drive[2] $Finished[2] = 1 ElseIf $i + $x <= $Percent[3] And $i + $x > $Percent[2] And $Finished[3] = 0 Then $Store = @CRLF & 'Current Drive: ' & $Drive[3] $Finished[3] = 1 ElseIf $i + $x > $Percent[3] And $Finished[4] = 0 Then $Store = @CRLF & 'Current Drive: ' & $Drive[4] $Finished[4] = 1 EndIf Next ProgressSet('100%', 'Memory Dump Completed', 'Finished') Sleep(4000) ProgressOff() while 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Case $msg = $cancel MsgBox(0,"Progress","Progress has been cancel") Exit Case $msg = $pause ;pause function Case $msg = $minimize ;minize function EndSelect WEnd
RazerM Posted April 26, 2006 Posted April 26, 2006 (edited) slightly abnormal - i changed it to use a progress control and labels expandcollapse popup#include <GUIConstants.au3> GUICreate("Physical Memory Dump",400,200) $cancel= GUICtrlCreateButton("Cancel",70,140,80,30) $pause= GUICtrlCreateButton("Pause",160,140,80,30) $minimize= GUICtrlCreateButton("Minimize",250,140,80,30) $title = GUICtrlCreateLabel("Dumping Physical Memory...",20,20) $subtext = GUICtrlCreateLabel("Dumping...", 20, 80, 400, 40) $progress = GUICtrlCreateProgress(20, 40, 360, 30) GUISetState() ;~ ProgressOn("Physical Memory Dump","Dumping Physical Memory...","Dumping...",-1,-1,1+2+16) Local $x = 0, $Drive[5] = ['', 'C:\', 'D:\', 'E:\', 'F:\'], $Percent[4] = ['', '40', '65', '85'], $Finished[5] = ['', 0, 0, 0, 0] Local $Store = @CRLF & 'Current Drive: ' & $Drive[1] For $i = 1 to 100 $x = $x + Random(1, 7, 1) Sleep(Random(100, 1500)) If $i + $x >= 100 Then ExitLoop GUICtrlSetData($progress, $i+$x) GUICtrlSetData($subtext, ($i + $x) & "%" & $Store) ;~ ProgressSet($i + $x, ($i + $x) & "%" & $Store) If $i + $x <= $Percent[2] And $i + $x > $Percent[1] And $Finished[2] = 0 Then $Store = @CRLF & 'Current Drive: ' & $Drive[2] $Finished[2] = 1 ElseIf $i + $x <= $Percent[3] And $i + $x > $Percent[2] And $Finished[3] = 0 Then $Store = @CRLF & 'Current Drive: ' & $Drive[3] $Finished[3] = 1 ElseIf $i + $x > $Percent[3] And $Finished[4] = 0 Then $Store = @CRLF & 'Current Drive: ' & $Drive[4] $Finished[4] = 1 EndIf Next GUICtrlSetData($progress, 100) GUICtrlSetData($subtext, "Memory Dump Completed") GUICtrlSetData($title, "Finished") ;~ ProgressSet('100%', 'Memory Dump Completed', 'Finished') Sleep(4000) ;~ ProgressOff() while 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Case $msg = $cancel MsgBox(0,"Progress","Progress has been cancel") Exit Case $msg = $pause ;pause function Case $msg = $minimize ;minize function EndSelect WEnd Edited April 26, 2006 by RazerM My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
slightly_abnormal Posted April 26, 2006 Posted April 26, 2006 (edited) thanks razer, heres my my changes edit i added info tag expandcollapse popup;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Fake/GUI Progress by ;Paulie ;SmOke_N ;RazerM ;slightly_abnormal ;;;;;;;;;;;;;;;;;;;;;;;;;;; #include <GUIConstants.au3> opt("guioneventmode",1) $gui= GUICreate("Physical Memory Dump",400,200) $cancel= GUICtrlCreateButton("Cancel",20,140,120,30);$cancel= GUICtrlCreateButton("Cancel",70,140,80,30) $pause= GUICtrlCreateButton("Pause",140,140,120,30);$pause= GUICtrlCreateButton("Pause",160,140,80,30) $minimize= GUICtrlCreateButton("Minimize",260,140,120,30);$minimize= GUICtrlCreateButton("Minimize",250,140,80,30) $title = GUICtrlCreateLabel("Dumping Physical Memory...",20,10,350);$title = GUICtrlCreateLabel("Dumping Physical Memory...",20,20) GUICtrlSetFont(-1,14,600) $subtext = GUICtrlCreateLabel("Dumping...", 20, 100, 400, 40);$subtext = GUICtrlCreateLabel("Dumping...", 20, 80, 400, 40) $progress = GUICtrlCreateProgress(20, 60, 360, 30);$progress = GUICtrlCreateProgress(20, 40, 360, 30) GUICtrlSetOnEvent($cancel, "_cancel") GUICtrlSetOnEvent($pause, "_pause") GUICtrlSetOnEvent($minimize, "_minimize") GUICtrlSetOnEvent($GUI_EVENT_CLOSE,"_cancel") GUISetState() ;~ ProgressOn("Physical Memory Dump","Dumping Physical Memory...","Dumping...",-1,-1,1+2+16) Local $x = 0, $Drive[5] = ['', 'C:\', 'D:\', 'E:\', 'F:\'], $Percent[4] = ['', '40', '65', '85'], $Finished[5] = ['', 0, 0, 0, 0] Local $Store = @CRLF & 'Current Drive: ' & $Drive[1] For $i = 1 to 100 $x = $x + Random(1, 7, 1) Sleep(Random(100, 1500)) If $i + $x >= 100 Then ExitLoop GUICtrlSetData($progress, $i+$x) GUICtrlSetData($subtext, ($i + $x) & "%" & $Store) ;~ ProgressSet($i + $x, ($i + $x) & "%" & $Store) If $i + $x <= $Percent[2] And $i + $x > $Percent[1] And $Finished[2] = 0 Then $Store = @CRLF & 'Current Drive: ' & $Drive[2] $Finished[2] = 1 ElseIf $i + $x <= $Percent[3] And $i + $x > $Percent[2] And $Finished[3] = 0 Then $Store = @CRLF & 'Current Drive: ' & $Drive[3] $Finished[3] = 1 ElseIf $i + $x > $Percent[3] And $Finished[4] = 0 Then $Store = @CRLF & 'Current Drive: ' & $Drive[4] $Finished[4] = 1 EndIf Next GUICtrlSetData($progress, 100) GUICtrlSetData($subtext, "Memory Dump Completed") GUICtrlSetData($title, "Finished") ProgressSet('100%', 'Memory Dump Completed', 'Finished') Sleep(4000) ;~ ProgressOff() GUISetState(@SW_HIDE,$gui) msgbox(0,"Finished!",'Progress sucessfully has been completed') Exit while 1 ;~ $msg = GuiGetMsg() ;~ Select ;~ Case $msg = $GUI_EVENT_CLOSE ;~ Case $msg = $cancel ;~ MsgBox(0,"Progress","Progress has been cancel") ;~ Exit ;~ Case $msg = $pause ;~;pause function ;~ Case $msg = $minimize ;~;minize function ;~ EndSelect WEnd func _cancel() $msgb = MsgBox(52,"Progress","Are you sure you want to cancel?") Select Case $msgb= 6;Yes ProgressOff() MsgBox(0,"Progress","Progress has been canceled") Exit Case $msgb= 7;No WinClose($msgb) EndSelect EndFunc func _pause() ;;<<<;pause function goes here EndFunc func _minimize() GUISetState(@SW_MINIMIZE,$gui) EndFunc Edited April 26, 2006 by slightly_abnormal
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