Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

File_WaitForFileToExist(sFile, iWaitMaxMin, iCheckIntervalSec, bMustExist)

Check if a specified file exist, and waits until file exist or until timeout occurs
If file is created before timeout occurs, gbValue returns TRUE, otherwise gbValue returns FALSE.

Arguments

ARGUMENT

DESCRIPTION

TYPE

sFile

The file to check existense/wait for

String

iWaitMaxMin

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

Integer

iCheckIntervalSec

Number of seconds between checks

Integer

bMustExist

If TRUE function will fail if timeout is reached and file does not exist

Boolean

Return Type

Boolean, TRUE if function completed successfully.

Example

The following example will create an empty textfile 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_WaitForFileToExist(sFile, 5, 10, False)
  If bStatus and NOT gbValue Then bStatus=Dialog_ShowWarning("Timeout occured waiting for file to be created")

  Job_End(bStatus)
'End main

See Also

IncludeScript function, Dialog_ShowWarning

  • No labels