Jump to content

afoo

Members
  • Posts

    3
  • Joined

  • Last visited

afoo's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Thank you. I think I figure out the issue why it don't works on my end here. Thanks again.
  2. Thank you very much abberration. I'm able to compile the script now. However, the file doesn't append on top but happens at the end of the file. I try with value 1, 0, -2. None working.
  3. Hi, I'm facing a problem to get the file compile properly. It indicate with error: $iFlag: possibly used before declaration, $iFlag: undeclared global variable. Below is my code. #NoTrayIcon #include <GUIConstantsEx.au3> #include <File.au3> Global $file, $sPath, $hFile, $vPath, $sDrive $file = FileOpen("backup-path.txt", 0) ; Open the directory file in read only mode. The directory path until $sPath only. $hFile = FileOpen("backup-sync.log", 1) ; Open the logfile in write mode. ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit ElseIf FileExists("I:\") Then sync() Else MsgBox(0, "Error", "I:\ drive not found") _FileWriteLog($hFile, 'I:\ drive not found', $iFlag <> -1) ; Write to the logfile with section ending _FileWriteLog($hFile, '*****', $iFlag <> -1) ; Write to the logfile with section ending EndIf Func sync() $vPath = InputBox("Define folder name", "Enter folder name", "WWxx dd-mm-yyyy", "", 200, 130) SplashTextOn("", "Syncing files. Please wait.", 250, 50, -1, -1, 16, "", 10) ; Read in lines of text until the EOF is reached While 1 DirCreate("I:\" & $vPath) Local $line = FileReadLine($file) If @error = -1 Then ExitLoop FileCopy($line, "I:\" & $vPath, 1) _FileWriteLog($hFile, 'Copied;'&@ComputerName&';'&$line, $iFlag <> -1) ; Write to the logfile passing the filehandle returned by FileOpen. _FileWriteLog($hFile, '*****', $iFlag <> -1) ; Write to the logfile with section ending. FileClose($hFile) ; Close the log file. FileClose($file) ; Close the directory file. Sleep(3000) WEnd SplashOff() MsgBox(0,"", "Sync completed.") EndFunc
×
×
  • Create New...