Reputation: 51
Is it possible to adjust the sleep() time (in autoit) to the time that the function being executed finishes, because setting a specific time value can ending up not being enough to the function. ( This function runs VietOCR and basically converts a PDF file to a TXT and sends it to another directory).
If the file is too big, the function will take more time and if I set for example 40 secs in "Sleep()" and the file isn't converted/moved yet, there's an error because the directory I will use ahead ( in the script, with the converted file) is empty.
Thanks for reading and sorry if i messed anything up, I would appreciate if someone could help me out.
Upvotes: 0
Views: 232
Reputation: 96
If you are waiting for an exe to finish that you start in your code, you should use the function "RunWait()".
That might not work for your case. You can also just sleep until a file exists.
func waitForFileToExist($fileName)
while 1
if (FileExists($fileName)) Then
ExitLoop
EndIf
sleep(1000)
WEnd
EndFunc
Upvotes: 1