Yeah, the problem with sleep is that it's always too long on a fast machine and never long enough on a slow machine.
Which program are you working with? I'd be happy to take a look if I can help.
I still use the "old" version of AutoIt for about half of my scripts, as Au3 appears so convoluted to a non-coder like me. Au3 does have its moments, however, like its ability to completely hide batch files, e.g.:
CODE
Run( @ScriptDir & "\cleanup.cmd", "", @SW_HIDE)
and eject the CD after the install:
CODE
$driveArray = StringSplit("DEFGHIJKLMNOPQRSTUVWXYZ", "")
For $i = 1 To 23
$opened = CDTray($driveArray[$i] & ":", "open")
If $opened Then ExitLoop
Next
If NOT $opened Then
Shutdown(6)
EndIf
I suspect Au3 aficionados are going to scream, but those are the only two features that I prize, together with the cleaner looking message boxes, e.g.:
CODE
SplashTextOn("", "" & @CRLF & "Installing Microsoft Money 2005 Premium..." & @CRLF & "" & @CRLF & "Please wait..." & @CRLF & "", 275, 90, -1, -1, 1, "Arial", 12, 12)
Sleep(4000)
SplashOff()
Those three, and a few others, have a place in my AutoIt snippet library.