vegaslaptop Posted August 22, 2005 Posted August 22, 2005 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!
JoshDB Posted August 23, 2005 Posted August 23, 2005 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
B3TA_SCR1PT3R Posted August 23, 2005 Posted August 23, 2005 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]
SupraNatural Posted August 23, 2005 Posted August 23, 2005 One thing i could suggest is doing something like $delay = FileGetSize("FileToCopy.ext") Sleep($delay) Visit http://www.blizzedout.com/forums/register....referrerid=8306 for the top blizzard hacks. WoW, TfT, D2/LOD, CS. You name it we got it!
GaryFrost Posted August 23, 2005 Posted August 23, 2005 Wondering why you don't use autoit's FileCopy or DirCopy, the script won't continue till the function completes. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
B3TA_SCR1PT3R Posted August 23, 2005 Posted August 23, 2005 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]
LxP Posted August 23, 2005 Posted August 23, 2005 (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 August 23, 2005 by LxP
vegaslaptop Posted August 23, 2005 Author Posted August 23, 2005 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
fsquirrelgpr Posted August 23, 2005 Posted August 23, 2005 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.
vegaslaptop Posted August 23, 2005 Author Posted August 23, 2005 (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 codeWhile MouseGetCursor() = 15 Sleep(1000)WEndWhile the cursor is on the hourglass icon wait. If anyone comes up with a better solution please feel free to PM.Thanks Edited August 23, 2005 by besnia
LxP Posted August 24, 2005 Posted August 24, 2005 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")
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