Variable existence test ("variable")

4.4.3 Variable Existence Test ("variable")

DESCRIPTION

The Variable Existence Test (code "variable") is not a real image comparison algorithm. It only uses the framework of the WaitFor command to wait for a session variable to appear or disappear in order to enable communication among scripts running in parallel within a workitem.

This mechanism can be used to implement the producer-consumer scenario:

  • One script (the "producer") performs a task, creates a session variable through the Varg command and suspends using Waitfor mismatch until the variable disappears.
  • Another script running in parallel (the "consumer") detects that the variable was created (Waitfor match), performs its task and deletes the variable using Varg to notify the first script of the job completion.

OPTIONS

 The "name" parameter specifies the variable name.  

The "passrate" parameter is accepted just for compatibility reasons but it is ignored if specified.  


RETURNS

The method makes the calling command (method call) return 0 (success) if the variable exists. Otherwise, it returns the value of 1.

EXAMPLES

Waitfor match method="variable" name="FLAG" timeout="5m"


if ({_EXIT_CODE} > 0) {
  Exit 1
desc="The other script failed to populate the FLAG variable within the timeout of 5 minutes!"
}


- Wait for another script to create a session variable called FLAG. If the variable fails to appear within 5 minutes exit the script.