Scripts
Scripts in Galago provide a powerful way to automate complex tasks and extend the platform’s functionality using Python, C#, or JavaScript. They allow you to create custom automation workflows, data processing routines, and integration with external systems across multiple programming languages.
Table of Contents
Overview
Galago supports scripting in three popular programming languages, allowing you to leverage your existing expertise and choose the best language for your specific automation needs. Whether you prefer Python’s data science libraries, C#’s robust framework, or JavaScript’s flexibility, Galago provides the environment and tools to build powerful automation scripts.
Supported Languages
- Python - Full Python 3 environment with extensive library support. Great for data processing, analysis, etc.
- C# - Complete .NET CORE 7 environment with access to the rich .NET ecosystem. Perfect for enterprise integrations and complex business logic implementations.
- JavaScript - Modern JavaScript runtime with Node.js capabilities and npm package support. Great for rapid prototyping.
Working with Scripts
Creating Scripts
- Navigate to the Scripts page
- Click “New Script”
- Select your preferred language (Python, C#, or JavaScript)
- Write your code in the editor with full syntax highlighting and IntelliSense
- Save and test the script
Script Features
- Multi-Language Support - Choose from Python, C#, or JavaScript based on your requirements and expertise.
- Package Management - Access to pip (Python), NuGet (C#), and npm (JavaScript) for external dependencies.
- Scheduled Execution - Run scripts on a schedule or trigger them from protocols and other events across all supported languages.
- Galago API Integration - Full access to Galago’s API and system functions regardless of chosen language.
Example Scripts
Python Example
from tools.toolbox.variables import get_all_variables
def main():
# Get all system variables
variables = get_all_variables()
for variable in variables:
for key, value in variable.items():
print(f"{key}: {value}")
if __name__ == "__main__":
main()
C# Example
var allVariables = await Variables.GetAllVariablesAsync();
var variableArray = allVariables.EnumerateArray();
foreach (var variable in variableArray)
{
foreach (var prop in variable.EnumerateObject())
{
Console.WriteLine($"{prop.Name}: {prop.Value}");
}
}
JavaScript Example
try {
const allVariables = await Variables.getAllVariables();
for (const variable of allVariables) {
for (const [key, value] of Object.entries(variable)) {
console.log(`${key}: ${value}`);
}
}
} catch (error) {
console.error('Error:', error.message);
}
Warning: Scripts have full access to the Galago API and can modify system state regardless of the programming language used. Always test scripts thoroughly before running them in a production environment.