debstep 0 Posted February 14, 2005 Share Posted February 14, 2005 (edited) Help, Would Anyone mind posting an example of how to update a progress bar based on the size of a file being copied? Here's my attempt after looking in the man pages..I know I an still far off but How do I set the prgress bar as a percentage of the file ? then update it in the gui? Sorry to be so dense about this, Dummy step be step isntructions will not be offensive Func InstallJavaPressed() Opt(GUIonEventMode,0) GuiCreate("Installing Java ", 369, 125,(@DesktopWidth-469)/2, (@DesktopHeight-639)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) GUICtrlCreateLabel("Installing JRE",10,10,150) $javaPB=GUICtrlCreateProgress(10,10,30,350,PBS_Smooth) if FileExists("D:\Installer\jre1.5.0_01.exe")Then $f = FileGetSize("D:\Installer\jre1.5.0_01.exe") MsgBox(262144,'debug line ~188' , 'FileGetSize("D:\Installer\jre1.5.0_01.exe"):' & @lf & FileGetSize("D:\Installer\jre1.5.0_01.exe"));### Debug MSGBOX FileInstall("D:\Installer\jre1.5.0_01.exe","C:\Program Files\Java Runtimes\jre1.5.1_01",1) GuiSetState() $wait = 20; wait 20ms for next progressstep $s = 0; progressbar-saveposition do $msg = GUIGetMsg() For $i = $s To $f $m = GUIGetMsg () GUICtrlSetData ($javaPB,$i) Sleep($wait) EndIf Next until $msg = $GUI_EVENT_CLOSE else msgbox (4096,"Source Error", "Source for JAVA_JRE invalid",5) exit endif EndFunc Edited February 14, 2005 by Larry Link to post Share on other sites
archrival 0 Posted February 14, 2005 Share Posted February 14, 2005 FileInstall is a "blocking" command, so the script will not continue, until the file is fully copied (installed)... To get a progessbar for a copy, you can manage a DLLCall... but to ProgressBar a "FileInstall"... I can't think of a way...best I could figure, is... you could launch a second script (or second instance of the current script using $cmdline parameters) and have it do the file install. It can set an indicator just before the fileinstall... the script sees this indicator and starts a progress-like animation... when the fileinstall is finished it can set a file done type indicator so that the animation can stop... it will not be a true progess bar, but a "copy in progress" indicator...Lar.<{POST_SNAPBACK}>Or to take that a little further, just have the secondary script get sent the file size of the file being copied and have it poll every 5 seconds or whatever the destination file size. Link to post Share on other sites
zeroZshadow 0 Posted February 15, 2005 Share Posted February 15, 2005 can dos return the bytes copyed??? if so use dos to coy file and autoit to show the progress bar *If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip... Link to post Share on other sites
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