Cravin Posted September 10, 2013 Share Posted September 10, 2013 (edited) So, for the life of me, even after spending a couple of hours of google and forum searches, I can't figure out how to update a progress bar in real time with the status of a file transfer using _LargeFileCopy. Any suggestions/helpful hints would be greatly appreciated! EDIT: The issue is that the progress bar stays at 0%, not updating as the file is transferred. The block of code I'm currently attempting which is not working is below: For $i = 0 To UBound($aFinal) - 1 $iFilesTransfered += 1 $CopyTo = StringReplace($aFinal[$i], $DataTabTargetNameInput, "C:\") GUICtrlSetData($CurrentFile, StringReplace($aFinal[$i], $DataTabTargetNameInput, "C:")) $SrcFileSize = FileGetSize($aFinal[$i]) _LargeFileCopy($aFinal[$i], $CopyTo, BitOR(1, 2, 64, 128, 256, 512)) While 1 $DestFileSize = FileGetSize($CopyTo) If $DestFileSize = $SrcFileSize Then ExitLoop Else $CurrentFilePctCopied = Round($DestFileSize / $SrcFileSize * 100, 1) _ProgressSet($Progress1, $CurrentFilePctCopied) _ProgressSetText($Progress1, $CurrentFilePctCopied) Sleep(250) EndIf WEnd If $iFilesTransfered = $tUniqueFiles Then GUICtrlSetData($CurrentFile, "Transfer finished!") $iFilesTransfered = 0 EndIf Next Edited September 10, 2013 by Cravin Link to comment Share on other sites More sharing options...
allSystemsGo Posted September 10, 2013 Share Posted September 10, 2013 What is the issue you are having? No progress bar is being displayed? Link to comment Share on other sites More sharing options...
Yashied Posted September 10, 2013 Share Posted September 10, 2013 Maybe >this will help you. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
Cravin Posted September 10, 2013 Author Share Posted September 10, 2013 What is the issue you are having? No progress bar is being displayed? Sorry, should have specified the current behavior: $Progress1 shows, it just doesn't update at all... Link to comment Share on other sites More sharing options...
Cravin Posted September 10, 2013 Author Share Posted September 10, 2013 Maybe >this will help you. Yashied, I considered using that Copy UDF you wrote but since my array returns files only and not folders, the LargeFileCopy udf I thought was easier to implement because it creates the dir structure without having to go back through and add that functionality in... unless I missed something about _Copy_CopyFile.. Link to comment Share on other sites More sharing options...
Yashied Posted September 10, 2013 Share Posted September 10, 2013 _Copy_CopyDir()? My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
Cravin Posted September 10, 2013 Author Share Posted September 10, 2013 _Copy_CopyDir()? Couldn't use CopyDir because it defeats the purpose of my script which is to be able to exclude multiple files/directories, so in order to form my array, I pass everything through M23's RecFileListToArray UDF and then combine those arrays into a single one, in this case named $aFinal and then call LargeFileCopy on each file from there... Link to comment Share on other sites More sharing options...
BrewManNH Posted September 10, 2013 Share Posted September 10, 2013 Can you post a reproducer script that demonstrates what it is you're doing and how? Right now we have several functions that we can't know what they're doing so it's practically impossible to know where you went wrong. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Cravin Posted September 10, 2013 Author Share Posted September 10, 2013 Can you post a reproducer script that demonstrates what it is you're doing and how? Right now we have several functions that we can't know what they're doing so it's practically impossible to know where you went wrong. Sure, give me a few moments to strip some things out, thanks! Link to comment Share on other sites More sharing options...
Cravin Posted September 10, 2013 Author Share Posted September 10, 2013 (edited) Attached is a copy of my script and all the includes required. It's fairly messy still so bear with me... and any thoughts in making it more efficient are welcome too. Note: To use, run the script named "FileCopyTest.au3", then enter the name of your local computer account, and in the UNC path section, enter your computer name, ie computerc$ - then select "Selective Copy" and check "C: Variances" and then Begin Transfer... All the selective options are implemented.. but you'll see during the progress, that the top progress bar stays at 0%. EDIT: Fixed the attachment so that it writes files to C:test Edited September 11, 2013 by Cravin Link to comment Share on other sites More sharing options...
Cravin Posted September 11, 2013 Author Share Posted September 11, 2013 Looking >HERE seems to be a possibility... seems LargeFileCopy has some form of a built in capacity to call a function that will check file size, but how could I implement this into my current script so that it properly updates $Progress1? Sorry for such newbie questions, I'm trying, really. Link to comment Share on other sites More sharing options...
allSystemsGo Posted September 11, 2013 Share Posted September 11, 2013 I think the problem lies somewhere within the While loop. Take it out of the while loop, and you get progress (not the intended progress though). Take a look again at the logic of the loop. Link to comment Share on other sites More sharing options...
Cravin Posted September 11, 2013 Author Share Posted September 11, 2013 I think the problem lies somewhere within the While loop. Take it out of the while loop, and you get progress (not the intended progress though). Take a look again at the logic of the loop. Yeah, I do believe you are correct.. I'm thinking perhaps Adlibregister may need to come into play some how here which I have no experience with. Thanks for the thoughts! Link to comment Share on other sites More sharing options...
Solution Cravin Posted September 11, 2013 Author Solution Share Posted September 11, 2013 I was able to get this figured out.. Basically, I created a function that did this: _LargeFileCopy($aFinal[$i], $CopyTo, BitOR(1, 2, 64, 128, 256, 512), 2097152, "", "_UpdateProgress") Func _UpdateProgress($iTotal, $iSize, $Percent) $Percent = Round(($iTotal / $iSize) * 100, 1) _ProgressSet($Progress1, $Percent) _ProgressSetText($Progress1, $Percent) EndFunc ;==>_UpdateProgress 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