Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5b

Application v 5.24b

  

 

Chapter SixFile Functions (continued)

QueryReadOnlyOverwrite Function

Overview

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

Syntax/Parameters

Syntax

int = QueryReadOnlyOverwrite ( 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 or the file is found but without the read-only attribute set, 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 QueryReadOnlyOverwrite function first determines whether or not the specified file exists with the read-only attribute set 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 QueryReadOnlyOverwrite 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