sutefan 0 Posted March 11, 2005 Hey, Is there a way to tell a script to wait till a particular file and directory exists before deleting it? The following works to a degree: ;;Delete Icon from User's Desktop and Start Menu WinWaitClose("InstallShield Wizard", "", 20) FileDelete($UPD) DirRemove($UPSM,1) MsgBox(0, "Finished", "Please restart the computer to complete the installation") The directory and icons in question are created as part of a installation program that this script runs earlier. There are times though due to computer speed, network activity where there can be a delay before the icons appear (longer than 20 seconds) and in these cases the script does not wait. Is there a better command than WinWaitClose to use in this scenario? Sutefan これは私の署名であり, 私の名前はsutefan である ! Share this post Link to post Share on other sites
MHz 80 Posted March 11, 2005 I use a For Next loop, to wait for shortcut creation etc. in install scripts. Then you can wait, but are not stuck in an endless loop either. For $i = 1 To 20; Adjust count if needed. If FileExists('Your file here') Then ExitLoop Sleep(250); Adjust time if needed. Next This will halt the script, until the FileExists, or til the loop count reaches 20. Share this post Link to post Share on other sites
SumTingWong 1 Posted March 11, 2005 (edited) Hey,Is there a way to tell a script to wait till a particular file and directory exists before deleting it? The following works to a degree:;;Delete Icon from User's Desktop and Start Menu WinWaitClose("InstallShield Wizard", "", 20) FileDelete($UPD) DirRemove($UPSM,1) MsgBox(0, "Finished", "Please restart the computer to complete the installation")The directory and icons in question are created as part of a installation program that this script runs earlier. There are times though due to computer speed, network activity where there can be a delay before the icons appear (longer than 20 seconds) and in these cases the script does not wait.Is there a better command than WinWaitClose to use in this scenario?Sutefan<{POST_SNAPBACK}>Why don't you just increase the timeout?WinWaitClose("InstallShield Wizard", "", 60)EDIT: Unless you are saying that the delay is happening after the InstallShield Wizard window has closed. Edited March 11, 2005 by SumTingWong Share this post Link to post Share on other sites