Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5b

Application v 5.24b

  

 

Chapter ThreeData Types and Operators (continued)

3.20 Handles

3.20.1 Introduction to Handles

Handles provide a method to reference objects. These objects can be Legato objects, custom-designed objects, or objects from external data sources and systems. Handles offer a means to access complex items such as files, text mapped for editing, file system enumeration information, and word parsing functions.

Legato handles are used to control access to predefined types of objects, such as Basic File or Mapped Text Objects. These handles are managed by the script engine, which means that they function in defined ways. They are also closed and released by the script engine upon a function’s return or the script’s termination, so an explicit statement to close a Legato handle is not necessary. Other handles for Windows items or program-defined objects may be employed, but these are not automatically “cleaned up” by the script engine. It is up to the programmer to properly create, maintain, and release non-Legato objects and their handles.

When operating in an environment where a script remains in memory, such as supporting a menu hook, programmers must be cautious about leaving certain objects open. For example, opening the clipboard and failing to close the handle is exceptionally bad form because the clipboard will not be accessible by any other program until the handle is closed.

Handle variables allow only limited use of operators: assignment (=), logical equality (==), and logical inequality (!=). An uninitiated or an empty handle may be 0 or NULL_HANDLE.

3.20.2 External Handles

It may be necessary or desirable to access handles for Windows objects or other components. These might include handles to dialog boxes, files, external libraries, and other items. These are accessible through various functions. Handles to external objects are not necessarily recognized or handled by the script engine; therefore, the programmer should exercise care in managing them.