brian873 Posted August 27, 2007 Share Posted August 27, 2007 Hi, I would like to create a progress bar that displays the percentage of a filecopy that is run from a system tray menu. I have looked through the help but cant see how to get the percentage information in to the progress bar, and my head is starting to hurt! Can anyone help? Thanks Link to comment Share on other sites More sharing options...
Achilles Posted August 28, 2007 Share Posted August 28, 2007 (edited) Hi, I would like to create a progress bar that displays the percentage of a filecopy that is run from a system tray menu. I have looked through the help but cant see how to get the percentage information in to the progress bar, and my head is starting to hurt! Can anyone help? Thanks Use expandcollapse popup#include <GUIConstants.au3> 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 Or ProgressOn("Progress Meter", "Increments every second", "0 percent") For $i = 10 to 100 step 10 sleep(500) ProgressSet( $i, $i & " percent") Next ProgressSet(100 , "Done", "Complete") sleep(500) ProgressOff() Edited August 28, 2007 by Piano_Man My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
brian873 Posted August 28, 2007 Author Share Posted August 28, 2007 Thanks for taking time to reply Piano_man! Sorry to be a pain but I still don't understand were my filecopy command would go to tie in with the progress bar? Could you help??? thanks Link to comment Share on other sites More sharing options...
Achilles Posted August 28, 2007 Share Posted August 28, 2007 Thanks for taking time to reply Piano_man!Sorry to be a pain but I still don't understand were my filecopy command would go to tie in with the progress bar?Could you help???thanksWell, I think that for a single FileCopy() you can't get the percent. Are you doing one file or multiple files? My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
brian873 Posted August 29, 2007 Author Share Posted August 29, 2007 It is a single file but it is 800mb coming from a USB drive, so it can take a few minutes. I would like to have it built in to my script with a progress bar. But if not I found this code yesterday that would do but its not a progress bar. I hope you can help Dim $source = "C:\bc\test" Dim $target = "C:\bc\1" _FileCopy($source, $target) Func _FileCopy($fromFile,$tofile) Local $FOF_RESPOND_YES = 16 Local $FOF_SIMPLEPROGRESS = 256 $winShell = ObjCreate("shell.application") $winShell.namespace($tofile).CopyHere($fromFile,$FOF_RESPOND_YES) EndFunc Link to comment Share on other sites More sharing options...
Achilles Posted August 30, 2007 Share Posted August 30, 2007 Ugh, I don't know much about objects.... Just an off the wall suggestion that probably won't work and that I'm too lazy to try: Try InetGet() for your file, that will give you the percentage if you calculate it right... I kind of doubt it lets you download stuff from a USB port instead of the internet though... My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
brian873 Posted August 30, 2007 Author Share Posted August 30, 2007 Thanks Piano man I'll keep searching! Link to comment Share on other sites More sharing options...
Danny35d Posted August 30, 2007 Share Posted August 30, 2007 For a single file copy you can try eltorro example "copy with progress".To try eltorro example you need to include larry APIFileReadWrite.au3 AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
brian873 Posted August 30, 2007 Author Share Posted August 30, 2007 Thanks Danny Just what I am looking for! I tried this script and had a problem so I will continue in that post. Thanks everyone for your help! 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