|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > Arrays and Data-Structures > LST. - List Arrays > Store/Restore-Operations > Smart Package Robot 's List Commands |
MiniRobotLanguage (MRL)
LST.FileRestore
Restore the Container from a File
Intention
The LST.FileRestore command is used to restore the contents of a list container from a file. This is useful when you need to reconstruct a list that was previously saved to a file using the LST.FileStore command.
The file contains a serialized string that represents the list's data and structure, allowing it to be fully restored to its original state.
Syntax
LST.FileRestore|P1|P2
Parameter Explanation
P1 - The handle of the list container. This is a numeric value or a variable that contains the handle of the list.
P2 - The file path to restore the list from. This can be a string or a variable containing the file path.
Example
'***********************************
' LST.FileRestore Sample Script
'***********************************
' Create a new list container
LST.New|$$LST
' Add values to the list
LST.Add|$$LST|Apple
LST.Add|$$LST|Banana
LST.Add|$$LST|Cherry
' Store the list to a file
LST.FileStore|$$LST|C:\Temp\list.txt
' Clear the list
LST.Clear|$$LST
' Restore the list from the file
LST.FileRestore|$$LST|C:\Temp\list.txt
' Display the restored values
LST.Get|$$LST|1|$$VAL1
LST.Get|$$LST|2|$$VAL2
LST.Get|$$LST|3|$$VAL3
DBP.Restored values: $$VAL1, $$VAL2, $$VAL3
' End the script
ENR.
Remarks
-
Limitations:
- The file must contain a valid serialized string generated using the LST.FileStore command. Using an invalid or corrupted file may result in errors.
See also:
• LST.New - Create a New List Container
• LST.FileStore - Store the Container to a File
• LST.Clear - Clear the List Container