File_WaitWhileExist

File_WaitWhileExist(sFile,iWaitMaxMin,iCheckIntervalSec)

Check if a specified file exists, and wait while the file exists or until a timeout occurs.
If the file is deleted before the timeout occurs, gbValue returns TRUE, otherwise gbValue returns FALSE.

Arguments

ARGUMENT

DESCRIPTION

TYPE

sFile

The file to check existence/wait for

String

iWaitMaxMin

Number of minutes to wait for the file to be deleted before exiting

Integer

iCheckIntervalSec

Number of seconds between checks

Integer

Return Type

Boolean, TRUE if function completed successfully.

Remarks

Example

The following example will create an empty text file and wait for up to 5 minutes for an external process to delete it.

Private Function IncludeScript(sScriptFile)
 '...
End Function

'Begin
  bStatus=True
  If bStatus Then bStatus=IncludeScript("customlib.cis")
  If bStatus Then bStatus=IncludeLibrary("Capalib.cin")
  If bStatus Then bStatus=IncludeLibrary("Osdlib.cin")
  If bStatus Then bStatus=Job_Start("WS","Script Name","1.0","ScriptName.log","INSTALL")
  If bStatus Then bStatus=OSD_Initialize()
  
  sFile="C:\WaitFile.txt"
  
  If bStatus Then bStatus=File_CreateEmptyFile(sFile, False)
  If bStatus Then bStatus=File_WaitWhileExist(sFile,5,10)
  If bStatus and NOT gbValue Then = Dialog_ShowWarning("Timeout occured waiting for file to be deleted")

  Job_End(bStatus)
'End main

See Also

IncludeScript function, Dialog_ShowWarning