Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5d

Application v 5.25a

  

 

Chapter SixFile Functions (continued)

QueryOverwrite Function

Overview

The QueryOverwrite function tests for the existence of the specified file. If the file exists, the function queries the user as to whether it can be overwritten with a message box.

Syntax/Parameters

Syntax

int = QueryOverwrite ( string name );

Parameters

name

A string containing a fully qualified path and filename.

Return Value

Returns an int indicating the condition of the file and/or the user’s response. If an error occurs other than file not found when the function accesses the file, a formatted error code will be returned and the GetLastError function can be used to retrieve error information. If the file does not exist but can be created, the function returns ERROR_NONE. If the file exists and the user indicates it is ok to overwrite, the function returns IDOK. If the file exists but the user indicates it should not be overwritten, the function returns IDCANCEL.

If a folder is selected as the name, ERROR_FUNCTION_NOT_SUPPORTED will be returned.

Remarks

The QueryOverwrite function first determines whether or not the specified file exists before querying the user with a message box about overwriting the file. The format and management of the message box is handled by the script engine. The message box might appear as follows:

 

Do not rely on the IsError function to determine if the user canceled the operation since the cancel code returned by the QueryOverwrite function is IDCANCEL rather than ERROR_CANCEL.

Related Functions

Platform Support

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

Legato IDE, Legato Basic