themax90 Posted January 17, 2005 Share Posted January 17, 2005 I have been trying alot to figure this out but I guess my brain is just FROZEN!!!! Can someone find a way or give an example of something like: While FileInstall ( Files, Directory ) If Directory - Proportional to percent Then ProgressSet( That Percent ) EndIf WEnd Something like that. Thanks, I been working awhile and to me it's a brain buster! Link to comment Share on other sites More sharing options...
this-is-me Posted January 17, 2005 Share Posted January 17, 2005 Fileinstall is a blocking function AFIAK therefore all other functions including progress bars won't work anyway. Who else would I be? Link to comment Share on other sites More sharing options...
ezzetabi Posted January 17, 2005 Share Posted January 17, 2005 People really want strange things... The only way I can think, is using two scripts. Like this, untested and wrote directly from the top of my head: Script 1 FileWrite(@tempdir & '\working.tmp','') ;Starts the other script here with a ShellExecute DLLCALL DirCreate('c:\dest') FileInstall('yourbigfile.exe','c:\dest') FileDelete(@tempdir & '\working.tmp') Script 2 ProgressOn('Proceed','') While FileExists(@tempdir & '\working.tmp') Sleep(100) $percent = 100 * DirGetSize('c:\dest') / $expectedsize ProgressSet($percent) WEnd ProgressOff() Link to comment Share on other sites More sharing options...
themax90 Posted January 17, 2005 Author Share Posted January 17, 2005 Well how about a file copy. How did Tidy create a installer. I want to great an installer but IN AUTOIT. If anyone has the brains to figure it out..... Link to comment Share on other sites More sharing options...
buzz44 Posted January 18, 2005 Share Posted January 18, 2005 i have also faced this small problem ... i was making a script to backup a directory to another .... the problem is .... this gets the size of the original directory and compares it to the size of the copied one ... its all good ... except ...... if you backup the folder to another directroy that already has files/folders in it the directroy size will be larger than the original .. stuffing everything outa whack ... this is wat i got so far also .. if u use DirCopy function .. it copies the files first b4 showing the progress bar .. so wat i had to do is call xcopy.exe so that the progress bar unpdates while the files are being copied ... and there are sum minor other bugs also not mentioned expandcollapse popup#include <file.au3> $OrigDirect = FileSelectFolder("Please select the folder you wish to backup.", "") If @error = 1 Then Exit Else $CopyDirect = FileSelectFolder("Where would you like to backup this folder to.", "", 1) If @error = 1 Then Exit Else CopyFolder($OrigDirect, $CopyDirect) EndIf EndIf Func CopyFolder($Folder1, $Folder2) $TempOrig = @TempDir & "\OrigTemp.txt" $OrigSearch = FileFindFirstFile($OrigDirect & "\*.*") _FileCreate ($TempOrig) $OpenOrig = FileOpen($TempOrig, 1) While 1 $OrigFile = FileFindNextFile($OrigSearch) If @error Then ExitLoop FileWrite($OpenOrig, $OrigFile & @CRLF) Wend FileClose($OpenOrig) $CountLines = _FileCountLines(@TempDir & "\origtemp.txt") Local $ProcID $ProcID = Run(@ComSpec & ' /c xcopy /e /h /y "' & $Folder1 & '" "' & $Folder2 & '"', "", @SW_HIDE) ProgressOn("Progress Meter", "Copy in progress.", 16) $OrigFileSize = DirGetSize($Folder1) Do $CopyFileSize = DirGetSize($Folder2) $MBCopy = DirGetSize($Folder2) / 1024 / 1024 $Percent = $CopyFileSize / $OrigFileSize * 100 $DecimalPlace = Round ($Percent) $DecimalPlaceMBCopy = Round ($MBCopy) ProgressSet ($percent, $DecimalPlace & "% " & "(" & $DecimalPlaceMBCopy & ") Mb has been copied.") EndIf Sleep(500) Until NOT ProcessExists($ProcID) ProgressOff () $CopyFileSize = DirGetSize($Folder2) $MBOrig = DirGetSize($Folder1) / 1024 / 1024 $DecimalPlaceMBOrig = Round ($MBOrig) $TempCopy = @TempDir & "\CopyTemp.txt" $CopySearch = FileFindFirstFile($CopyDirect & "\*.*") _FileCreate ($TempCopy) $OpenCopy = FileOpen($TempCopy, 1) While 1 $CopyFile = FileFindNextFile($CopySearch) If @error Then ExitLoop FileWrite($OpenCopy, $CopyFile & @CRLF) Wend FileClose($OpenCopy) $Text = FileRead($TempOrig, FileGetSize($TempOrig)) $H_Input = FileOpen($TempCopy, 0) $count = 0 While 1 $Word = FileReadLine($H_Input) If @error Then ExitLoop If StringInStr($Text, $Word) Then $Count = $Count + 1 Else $Count = $Count EndIf WEnd If $Count = $CountLines Then Msgbox(0,"Backup Complete", "All " & $Count - 2 & " Files/Folders were copied successfully.") Else Msgbox(0,"Error!", "The backup did not complete successfully. Only " & $Count - 2 & " File/Folders copied successfully.") EndIf FileDelete ($TempOrig) FileDelete ($TempCopy) EndFunc qq 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