Filesystem-Commands

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Filesystem-Commands >

Filesystem-Commands

WFF. - Wait For File

Previous Top Next


MiniRobotLanguage (MRL)

 

WFF. Command

Wait For File

 

NTFS-DirectWildcards_enabled_01

 

Intention

 

This command is useful to make your batch scripts error-tolerant. Using WFF. you can really wait until a file is available and accessible. Or you can use it to wait until a file is really deleted.

This way you can synchronize batch scripts via files.

 

WFF. can be used in two ways:

 

1. Wait until a file is available

2. Wait until a file has disappeared

 

In both cases you can set a "timeout" value, or wait endless. In case you use a Timeout-Value, the timeout-Flag will be set only if that timeout was reached.

You can check the TImeout-Flag using  the JIT. or ITO. and such commands.

 

If you wait for a file, WFF. will also check if the file is accessible. If it can be "opened for read".

If the file is still locked because its not yet "ready", WFF. will not accept the file in case 1 (Wait for a file).

 

In case 2 (Wait for a file to be deleted), the file must disappear, a locked file does not count as "deleted".

 

This system makes WFF. a perfect companion for synchronizing Batch-Jobs with compilers and such.

Because it will wait until one task is ready and then start the next.

 

 

 ' Sample Script

  VAF.§§FJB=§§FIA\Openfile_lock*.txt

  WFF.§§FJB|1
  JIT.ero

 

 

 

Syntax

 

 

WFF.[P1] [|P2]

 

' Wait for file

WFF.(Filename)

WFF.(Filename)|Timeout in sec.

' Wait for file being deleted

WFF.<>(Filename)

WFF.<>(Filename)|Timeout in sec.

 

 

Parameter Explanation

 

P1 - File Name

 

P2 - Timeout in seconds

 

If you add the "<>" before the filename, WFF. will wait until the file is been deleted.

 

 

Example

 

 

'*****************************************************

' EXAMPLE 1: WFF/ATF. Append without Newline

' Create a file containing large numbers

' Synchronize two robots using a file.

'*****************************************************

: $$FIL=?desktop\RND.txt

' Run a second robot.

' Note that the second robot knows the value of $$FIL

PRR.

 DOL.

   PRT.Parallelrobot started, waiting for File ...

   WFF.$$FIL

   PRT.File existst ... now waiting for the file to be deleted.

   WFF.<>$$FIL

   PRT.File was removed. Ending ...

   PAU.2

   GTO.out

 OOP.

 :out

 END.

PRE.

' This is the filename and path on the desktop

: $$FIL=?desktop\RND.txt

 

FOR.$$AAA|1|20

' Generate a Random Number between 124 and 123125

 RND.124,123125,$$REB

' Append the Numbers to the File without Newline

 ATF.$$FIL|$$REB|$$ERG

NEX.

DEL.$$FIL

MBX.Ready

END.

'*****************************************************

 

 

 

Remarks

 

-

 

 

Limitations:

 

-

 

 

See also:

 

    ATF - Append-to-File

    CFF. - Copy-From-File

    CTF - Copy-To-File

    CTI. - Copy-To-Inifile

    CFI. - Copy-From_IniFile

    COP. - Copy File

    FEL - For-Each-Line

    GLC. - Get-Line-Count

    IEF. / NEF. - If - exist - File

    LFF - Line-From-File

    SHF. - Shell-File-Operation