NiceBoy1234 Posted January 11, 2016 Posted January 11, 2016 (edited) expandcollapse popup#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 EndFuncBETTER 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 January 11, 2016 by NiceBoy1234
JohnOne Posted January 11, 2016 Posted January 11, 2016 DirCopy does not return until it is finished. (Blocking Function) AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
NiceBoy1234 Posted January 11, 2016 Author Posted January 11, 2016 So it returns something if it is finished?
TheDcoder Posted January 11, 2016 Posted January 11, 2016 (edited) @NiceBoy1234 I already told you that 2 times in Chatbox Edited January 11, 2016 by TheDcoder EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion
NiceBoy1234 Posted January 11, 2016 Author Posted January 11, 2016 Sorry, I mean like get a value out of it so I can check like if blabla = 1 exit ...
JohnOne Posted January 11, 2016 Posted January 11, 2016 Check the help file, under DirCopy, funnily enough. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
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