Meet Virtel Maple 3.4.x! New UI, Custom colors, PQCrypto and Fixes.

Download

System

Managing System Operations

Objective: Manage system functions like program management and logging.

Steps:
  • 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.

Steps:
  • 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

sys apps

Gets a list of all available programs in the system and stores their identifiers in a new list.

sys apps (newListName)
  • newListName: The name of the new list variable where the program identifiers will be stored (type: LIST).
sys apps programsList; lst len programsList count; csl write count;

This example retrieves the list of installed programs, gets its length, and prints the number of programs to the console.

sys files

Gets the path to the user's files directory and stores it in a new variable.

sys files (newVarName)
  • newVarName: The name of the new variable where the path will be stored (type: VAR).
sys files userFilesPath; csl write userFilesPath;

This Medicaid example retrieves the user files path and prints it to the console.

sys flowname

Gets the name of the current flow and stores it in a new variable.

sys flowname (newVarName)
  • newVarName: The name of the new variable where the flow name will be stored (type: VAR).
sys flowname currentFlowName; csl write currentFlowName;

This example retrieves the current flow name (e.g., "flow-0") and prints it to the console.

sys log

Gets all program logs as a single string, separated by newlines, and stores it in a new variable.

sys log (newVarName)
  • newVarName: The name of the new variable where the logs will be stored (type: VAR).
sys log logs; fls write "$/logs.txt" logs;

This example retrieves the logs and saves them to a file at "/system/logs.txt".

sys start

Starts a program by its appId.

sys start (appId)
  • appId: The identifier of the program to start (type: VAR).
sys start "vladceresna.virtel.textly";

This example starts the "vladceresna.virtel.textly" program.

sys homedir

Gets the path to the system's home directory and stores it in a new variable.

sys homedir (newVarName)
  • newVarName: The name of the new variable where the path will be stored (type: VAR).
sys homedir homeDir; csl write homeDir;

This example retrieves the system home directory path (e.g., "/system") and prints it to the console.

sys install

Installs a program from a VAR file contained in a variable.

sys install (appId) (contentVAR)
  • appId: The identifier of the program to install (type: VAR).
  • contentVAR: The variable containing the VAR file content of the program (type: VAR).
fls read "$/app.var" varContent; sys install "vladceresna.virtel.textly" varContent;

This example reads a VAR file from "/system/app.var" and installs it as "vladceresna.virtel.textly".

sys pack

Packages a program by its appId into a VAR file and stores it in a new variable.

sys pack (appId) (contentVARNewVarName)
  • 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).
sys pack "vladceresna.virtel.textly" packedVar; fls write "$/packedApp.var" packedVar;

This example packages "vladceresna.virtel.textly" into a VAR file and saves it to "/system/packedApp.var".

sys clear

Clears the current flow's data and removes it from the program.

sys clear (newVarName)
  • newVarName: The name of a variable (not used in the current implementation but required by syntax).
sys clear "unusedVar";

This example clears the current flow's data and removes it from the program.

sys backup

Creates a backup of the system to a specified file.

sys backup (filePath)
  • filePath: The path to the file where the backup will be stored (type: VAR).
sys backup "$/backup/system.bak";

This example creates a system backup at "/system/backup/system.bak".

sys restore

Restores the system from a backup file.

sys restore (filePath)
  • filePath: The path to the backup file (type: VAR).
sys restore "$/backup/system.bak";

This example restores the system from "/system/backup/system.bak".

sys inlife

Sets the "inlife" mode for the flow, determining whether it can be stopped (true prevents stopping).

sys inlife (value)
  • value: A boolean value ("true" or "false") to set the mode (type: VAR).
sys inlife "true"; run pause "5000"; sys inlife "false";

This example sets the flow to "inlife" mode for 5 seconds, making it unstoppable, then disables it.

sys settings

Opens the system settings interface.

sys settings
    sys settings;

    This example opens the Virtel system settings window.

    sys open-app

    Opens a program by its appId.

    sys open-app (appId)
    • appId: The identifier of the program to open (type: VAR).
    sys open-app "vladceresna.virtel.textly";

    This example opens the "vladceresna.virtel.textly" program.

    dtm now

    Gets the current time in milliseconds since the epoch and stores it in a new variable.

    dtm now (newVarName)
    • newVarName: The name of the new variable where the time will be stored (type: VAR).
    dtm now currentTime; csl write currentTime;

    This example retrieves the current time (e.g., "1698777600000") and prints it to the console.

    dtm format

    Formats a time in milliseconds into a string based on a pattern and optionally a timezone, storing the result in a new variable.

    dtm format (now) (format) [/timezone/] (contentVARNewVarName)
    • 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).
    dtm now currentTime; dtm format currentTime "yyyy-MM-dd" "UTC" formattedDate; csl write formattedDate;

    This example gets the current time, formats it as "yyyy-MM-dd" in UTC (e.g., "2023-10-31"), and prints it.

    csl error

    Logs an error message and throws an exception, stopping the flow execution.

    csl error (text)
    • text: The error message to log and throw (type: VAR).
    csl error "Something went wrong";

    This example logs "Something went wrong" as an error and stops the flow with an exception.

    csl write

    Writes a message to the program logs.

    csl write (text)
    • text: The message to write to the logs (type: VAR).
    csl write "Program started";

    This example writes "Program started" to the logs.

    csl read

    Reads user input from the console and stores it in a variable. It allows you to interact with the user.

    csl read (newVarName)
    • newVarName: The name of the variable where the read value will be stored (type: VAR).
    csl read userInput; csl write userInput;

    This example reads user input (e.g., "Hello") and prints it back to the console.

    stg set

    Stores a value in the program's storage under a specified key.

    stg set (name) (value)
    • name: The key to store the value under (type: VAR).
    • value: The value to store (type: VAR).
    stg set "userName" "John";

    This example stores "John" under the key "userName" in the program's storage.

    stg get

    Retrieves a value from the program's storage by key and stores it in a new variable.

    stg get (name) (newVarName)
    • name: The key to retrieve the value from (type: VAR).
    • newVarName: The name of the new variable to store the value (type: VAR).
    stg set "userName" "John"; stg get "userName" retrievedName; csl write retrievedName;

    This example retrieves "John" from "userName" and prints it.

    stg del

    Deletes a value from the program's storage by key.

    stg del (name)
    • name: The key to delete (type: VAR).
    stg set "userName" "John"; stg del "userName";

    This example deletes the "userName" key from the storage.

    tts say2

    Speaks text using cached MP3 files in "/virtel/tts-cache", generating the file if it doesn’t exist.

    tts say2 (text)
    • text: The text to speak (type: VAR).
    tts say2 "Hello";

    This example speaks "Hello" through audio output.