Jump to content

Check if DirCopy has finished


Recommended Posts

#include <AutoItConstants.au3>
#include <Misc.au3>
#include <MsgBoxConstants.au3>
#include <WinAPIFiles.au3>
#include <FileConstants.au3>
#include <Array.au3>

   Local $bFpExists = False
   Local $aDrives = DriveGetDrive($DT_REMOVABLE) ; usbs
   Local $sLockdown = "C:\Work\Lockdown.exe"
   Local $sPassword = "test"

   HotKeySet("+!x", "hiddenShortcut") ; Shift-Alt-x
   While 1
      Sleep(3000)
      searchForDrives()
   WEnd

   Func startApplicationConstantly()

      Local $barfExe = Run("C:\Work\test\test\test01.exe")

   EndFunc

   Func searchForDrives()

      Local $hTimer = TimerInit()
      Local $iRows = UBound($aDrives, $UBOUND_ROWS) ; Total number of rows.
      ConsoleWrite("Number of Rows " & $iRows & @CRLF)

      If @error Then
         startApplicationConstantly()
      Else
         If ($iRows > 0) Then

            For $i = 1 To $aDrives[0]

               Local $aUniqueFolderData = StringUpper($aDrives[$i]) & "\test_update"
               ConsoleWrite(StringUpper($aDrives[$i]) & "Drive " & $i & "/" & $aDrives[0] & @CRLF)
               ConsoleWrite($aDrives[$i] & @CRLF)

               If FileExists($aUniqueFolderData) Then
                  DirCopy($aUniqueFolderData & "\videos\", "C:\Work\test\test01\videos", $FC_OVERWRITE)
                  FileCopy($aUniqueFolderData & "\test01.swf", "C:\Work\test\test01", $FC_OVERWRITE)
                  startApplicationConstantly()
                  ExitLoop
               Else
                  ConsoleWrite("no usb " & @CRLF)
               EndIf

            Next

         EndIf
      EndIf
   EndFunc

BETTER EXPLANATION:
So my program shall start an video.exe once files from the usb device are copied.
The program keeps looping (While loop at the start of the script), so that I can plug off and plug in usb devices for future copy processes.
Problem now is to somehow check if the first copy process has been successfully finished.
If it has finished the copy loop shall finish as well.
Then the user will plug off the usb device, once a new usb device has been plugged in the copy process shall start again and so on...

Edited by NiceBoy1234
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...