Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5b

Application v 5.24b

  

 

Chapter FiveGeneral Functions (continued)

ProgressUpdate Function

Overview

The ProgressUpdate function updates the progress bar on the progress window or updates the results if running in command line mode.

Syntax/Parameters

Syntax

int = ProgressUpdate ( [int value1, [int value2] );

Parameters

value1

An optional int containing the percentage (1 to 100%) to advance the value if value2 is not provided. If value2 is provided, then value1 is presumably the count or index within the range of value2 from which the percentage is derived.

Omitting the parameter will read the cancel state (if enabled) of the progress window and allow the window to yield.

value2

An optional int used with value1 to provide a basis for progress. The progress bar will be advanced value1 percentage of value2. This relieves the script from having to calculate the progress. When this mode is used, the progress bar will only update if the percentage total changes. This value cannot be less than 1.

Return Value

Returns an int as ERROR_NONE on success, ERROR_CANCEL if the progress window is cancelled, or -1 on error. Use the GetLastError function to retrieve error information.

Remarks

Because a non-zero return value can indicate both a cancelled operation and an error, do not blindly check the return value of the ProgressUpdate function as a basis for terminating a script. If the progress window fails to open or is in use by another process, the script may be terminated on a false cancel.

The overall progress position depends on both the percentage and the number of phases. Use the ProgressSetPhase and ProgressSetPhaseCount functions to control the number and advancement of phases.

If no progress window is open or if the progress window is owned by another process when the ProgressUpdate function is called, the GetLastError function will return ERROR_SOFT.

The progress is updated (and a yield is performed) each time the percentage changes. Repeatedly calling the ProgressUpdate function is not expensive since it tracks the last displayed percent and will not update the screen if the percentage does not change. When the function is called with no parameters, the yield is processed and therefore the speed of the script can be impacted. For example, calling for a yield 10 million times during a process will affect the speed of the operation.

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic