NiceBoy1234

Check if DirCopy has finished

6 posts in this topic

#1 ·  Posted (edited)

#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

Share this post


Link to post
Share on other sites



So it returns something if it is finished?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

@NiceBoy1234 I already told you that 2 times in Chatbox :P

Edited by TheDcoder

AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites

Sorry, I mean like get a value out of it so I can check like if blabla = 1 exit ...

Share this post


Link to post
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

  • Similar Content

    • Nareshm
      By Nareshm
      Hi All,
      I have excel file like this
      and i want to cut cell/text from excel to other software.

       
      I have to cut the cell of B column one by one and past into other software
      If Winexists("No Data Found")
      then restore cuted cell and goto next/down side cell
      How to do it ?
    • Mag91
      By Mag91
      Hey Community,
      cause im too new in the Auto it world i will try it with the your help. hopefully.
      I woud like to know how i can handle my Problem.
      ----
      I have a Excel Data with 362 random numbers.
      For Example:
      1166642335374 1172899897343
      .....
      this numbers are a part of the filepath ...example
      D:\Projekte\1166_64233_5374
      as u can see its the first number of the Excel data. After the first 4 numbers it shoud make a "_" than another 5 "_"
      This is my first question. How can i handle this to make it Shell execute.
       
      --------
      Second question:
      If i am in the path.
      For Example:
      D:\Projekte\1166_64233_5374
      the code shoud search for specific PDF Files.
      They are named like: 0050569E364B1ED79B900F73E62660EC.pdf
      the first 15 letters are always the same
      0050569E364B1ED
      when he found this data he has to copy it on a Folder on the Desktop.
      (There can also be 2 or 3 pdfs in one Folder with this letters)
      ----
      Please give me some help :-)
       
       
       
       
       
       
    • Mag91
      By Mag91
      Hey Everybody,
      as you know im on a very low autoit-level.
      My question is: How can i read all PDFs from a Folder wich is open and copy them to a Folder on a Desktop.
       
      The Folder wich contains the PDFs is variable Z:\Projektls\"*"*"*EVERYTIME ANOTHER ENDING"*"*"*"*"
      There can be 1 PDF or even 15 PDFs.
      i tried it with _FileListToArray and _FileCopy but i Need some help to understand this language
       
      THANKS!
       
    • tcurran
      By tcurran
      Here's a short UDF that will, at least in most cases, detect whether a window can be copied from or pasted to programmatically--for example, by Send()ing ctl-c, ctl-v. This is often disabled when programs (like your AutoIt script) run at a lower UAC integrity level than the application they are trying to operate on.
      #include <WinAPI.au3> Func _WindowIsPasteable($handle) ;accepts window handle; returns true or false whether a window will accept Ctl-C, Ctl-V Local $bCanPaste = True Local $hTestWindowPID = 0 Local $hTestWindowTID = _WinAPI_GetWindowThreadProcessId($handle, $hTestWindowPID) _WinAPI_AttachThreadInput(_WinAPI_GetCurrentThreadId(), $hTestWindowTID, True);attach to window we want to paste into $bCanPaste = _WinAPI_GetFocus() ;Test whether window is paste-able--returns False if it is not _WinAPI_AttachThreadInput(_WinAPI_GetCurrentThreadId, $hTestWindowTID, False);detach from window thread Return $bCanPaste EndFunc Pass it a window handle; it returns true or false whether a window will accept programmatic pasting. The function may not work on the CMD window, since it handles the clipboard uniquely.
      This function works by attaching to the program thread of the window whose handle it receives, then attempting to perform a GetFocus on that thread. In most cases, the attempt will fail if the window will not accept programmatic copy-paste.
    • KimberlyJillPereira
      By KimberlyJillPereira
      May I know how to copy the first 10 characters in excel and paste it in the file explorer textbox? How to do? I know that you show use the StringLeft() function but I am not sure how to do. Please help me. Thank you!