Jump to content

Recommended Posts

Posted

Hello everyone,

I looked through the forum but could not exactly find what I was looking for. I am writing a program that does multiple tedious and boring tasks and one of the steps is to copy files to a folder. The files are large and it takes some time for them to be copied over. But how do I make the program wait until it copies everything and then proceed with the for loop. At this point I tried WinWaitActive but the widnow is active because it's busy copying so it just ignores that command and continues the loop. I was thinking of using WinGetProcess but when I read the help file it did not seem like it is exactly what I am looking for. ANY help is appreciated.

Thanks in advance!

Posted

You could try...

While WinActive("Your Window")

Sleep(1000)

wEnd

Hope I helped. Newbie here also ^^;

Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite
Posted

try file read to array

and when the number of files that was copyied is reached then continue with the rest of the loop

If $filenumber = *number of files supposed to be coppyied* Then Continue (or soming)

[right][font="Courier New"]...Run these streets all day, I can sleep when I die.[/font] [/right]

Posted

Wondering why you don't use autoit's FileCopy or DirCopy, the script won't continue till the function completes.

<{POST_SNAPBACK}>

BURNNNNNNNNN

[right][font="Courier New"]...Run these streets all day, I can sleep when I die.[/font] [/right]

Posted (edited)

How are you currently achieving the file copy? If you don't mind using DOS to get the job done then you could do something like this:

Edit: It will wait until the copy is complete before executing any further instructions.

local $dosCmd = 'copy "C:\Old Location\*.dat" "C:\New Location"'
runWait(@comSpec & " /c " & $dosCmd, "", @SW_HIDE)
Edited by LxP
Posted

Hey thanks for the input everyone. It is a program that uses explorer and I am not very familiar with it (documentum) and there's no way I can use DOS, nor FileCopy because documentum is linked to a SQL server and gets a sorted list of files in explorer pop-up window. If you have another solution and do not mind sharing would be greatly appreciated.

Thanks

Posted

Hey thanks for the input everyone. It is a program that uses explorer and I am not very familiar with it (documentum) and there's no way I can use DOS, nor FileCopy because documentum is linked to a SQL server and gets a sorted list of files in explorer pop-up window. If you have another solution and do not mind sharing would be greatly appreciated.

Thanks

<{POST_SNAPBACK}>

If you can check where the file is being copied to, try something like

;Your copy command/function here
$size = filegetsize($NEWfilename)
sleep(1000)
while(filegetsize($filename) <> $size)
    $size = filegetsize($filename)
    sleep(1000)
wend

Then when the file size stops changing, you know you are done copying.

Posted (edited)

I think I found a temporary solution to my problem in a different topic, I am not sure whose response it was but this is the code

While MouseGetCursor() = 15

         Sleep(1000)

WEnd

While the cursor is on the hourglass icon wait. If anyone comes up with a better solution please feel free to PM.

Thanks

Edited by besnia
Posted

This doesn't appear to have been mentioned or asked yet -- does a window appear or disappear (as opposed to gain or lose focus) when the copy operation completes? Will something like this work? --

winWaitClose("Copying")

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...