System
Managing System Operations
Objective: Manage system functions like program management and logging.
- Get a list of installed programs:
sys apps programsList; lst len programsList count; csl write count;
- "programsList" is the list of program identifiers.
- "count" is the number of programs.
- Start a program:
sys start "vladceresna.virtel.textly";
- "vladceresna.virtel.textly" is the program identifier.
- Log a message:
csl write "Program started";
Practical Example
Objective: Install a program from a VAR file.
- Read and install a program:
fls read "$/app.var" varContent; sys install "vladceresna.virtel.textly" varContent;
Tips
- Use
sys log
to retrieve all logs for debugging. - Regularly back up the system with
sys backup
. - Set
sys inlife "true"
for critical flows that shouldn’t stop.
Conclusion
System commands provide essential tools for managing programs, logs, and system state, ensuring a stable Virtel environment.
Commands
Gets a list of all available programs in the system and stores their identifiers in a new list.
newListName
: The name of the new list variable where the program identifiers will be stored (type: LIST).
This example retrieves the list of installed programs, gets its length, and prints the number of programs to the console.
Gets the path to the user's files directory and stores it in a new variable.
newVarName
: The name of the new variable where the path will be stored (type: VAR).
This Medicaid example retrieves the user files path and prints it to the console.
Gets the name of the current flow and stores it in a new variable.
newVarName
: The name of the new variable where the flow name will be stored (type: VAR).
This example retrieves the current flow name (e.g., "flow-0") and prints it to the console.
Gets all program logs as a single string, separated by newlines, and stores it in a new variable.
newVarName
: The name of the new variable where the logs will be stored (type: VAR).
This example retrieves the logs and saves them to a file at "/system/logs.txt".
Starts a program by its appId.
appId
: The identifier of the program to start (type: VAR).
This example starts the "vladceresna.virtel.textly" program.
Gets the path to the system's home directory and stores it in a new variable.
newVarName
: The name of the new variable where the path will be stored (type: VAR).
This example retrieves the system home directory path (e.g., "/system") and prints it to the console.
Installs a program from a VAR file contained in a variable.
appId
: The identifier of the program to install (type: VAR).contentVAR
: The variable containing the VAR file content of the program (type: VAR).
This example reads a VAR file from "/system/app.var" and installs it as "vladceresna.virtel.textly".
Packages a program by its appId into a VAR file and stores it in a new variable.
appId
: The identifier of the program to package (type: VAR).contentVARNewVarName
: The name of the new variable where the VAR file content will be stored (type: VAR).
This example packages "vladceresna.virtel.textly" into a VAR file and saves it to "/system/packedApp.var".
Clears the current flow's data and removes it from the program.
newVarName
: The name of a variable (not used in the current implementation but required by syntax).
This example clears the current flow's data and removes it from the program.
Creates a backup of the system to a specified file.
filePath
: The path to the file where the backup will be stored (type: VAR).
This example creates a system backup at "/system/backup/system.bak".
Restores the system from a backup file.
filePath
: The path to the backup file (type: VAR).
This example restores the system from "/system/backup/system.bak".
Sets the "inlife" mode for the flow, determining whether it can be stopped (true prevents stopping).
value
: A boolean value ("true" or "false") to set the mode (type: VAR).
This example sets the flow to "inlife" mode for 5 seconds, making it unstoppable, then disables it.
Opens the system settings interface.
This example opens the Virtel system settings window.
Opens a program by its appId.
appId
: The identifier of the program to open (type: VAR).
This example opens the "vladceresna.virtel.textly" program.
Gets the current time in milliseconds since the epoch and stores it in a new variable.
newVarName
: The name of the new variable where the time will be stored (type: VAR).
This example retrieves the current time (e.g., "1698777600000") and prints it to the console.
Formats a time in milliseconds into a string based on a pattern and optionally a timezone, storing the result in a new variable.
now
: The time in milliseconds (type: VAR).format
: The date format pattern (e.g., "yyyy-MM-dd") (type: VAR)./timezone/
: Optional timezone (e.g., "UTC", "Europe/Kiev") (type: VAR).contentVARNewVarName
: The name of the new variable for the formatted string (type: VAR).
This example gets the current time, formats it as "yyyy-MM-dd" in UTC (e.g., "2023-10-31"), and prints it.
Logs an error message and throws an exception, stopping the flow execution.
text
: The error message to log and throw (type: VAR).
This example logs "Something went wrong" as an error and stops the flow with an exception.
Writes a message to the program logs.
text
: The message to write to the logs (type: VAR).
This example writes "Program started" to the logs.
Reads user input from the console and stores it in a variable. It allows you to interact with the user.
newVarName
: The name of the variable where the read value will be stored (type: VAR).
This example reads user input (e.g., "Hello") and prints it back to the console.
Stores a value in the program's storage under a specified key.
name
: The key to store the value under (type: VAR).value
: The value to store (type: VAR).
This example stores "John" under the key "userName" in the program's storage.
Retrieves a value from the program's storage by key and stores it in a new variable.
name
: The key to retrieve the value from (type: VAR).newVarName
: The name of the new variable to store the value (type: VAR).
This example retrieves "John" from "userName" and prints it.
Deletes a value from the program's storage by key.
name
: The key to delete (type: VAR).
This example deletes the "userName" key from the storage.
Speaks text using cached MP3 files in "/virtel/tts-cache", generating the file if it doesn’t exist.
text
: The text to speak (type: VAR).
This example speaks "Hello" through audio output.