SnapRun provides a comprehensive set of features designed to make Windows automation simple, powerful, and accessible. Here's everything you can do with SnapRun.
- Modern Syntax: Rust-like syntax that's easy to learn and read
- Type Safety: Dynamic typing with runtime type checking
- Error Handling: Comprehensive error reporting and debugging
- Performance: Native execution speed with Rust backend
- Sandboxed: Secure execution environment with controlled system access
- Glass Effects: Windows 10+ transparency with blur effects
- Dark Theme: Eye-friendly dark interface with accent colors
- Responsive Design: Adaptive layout that works on any screen size
- Live Updates: Real-time script output and progress feedback
- Intuitive Controls: Clean, modern interface inspired by Windows 11
- System Tray: Runs in background with quick access from tray
- Global Shortcuts:
Ctrl+Shift+J- Show/Hide applicationCtrl+W- Hide application (doesn't close)
- Auto-Start: Optional automatic startup with Windows
- File Associations: Double-click
.rhaifiles to run them
// Read file contents
let content = read_file("path/to/file.txt");
// Write file contents
write_file("output.txt", "Hello, World!");
// Check if file exists
if file_exists("important.txt") {
print("File found!");
}
// Copy files
copy_file("source.txt", "destination.txt");
// Move files
move_file("old_location.txt", "new_location.txt");
// Delete files
delete_file("temporary.txt");
// Create directories
md("new_folder");
md("path/to/nested/folders");
// List directory contents
let files = list_dir("C:/Users/Username/Documents");
for file in files {
print(file);
}
// Change directory
cd("C:/Projects");
// Get current directory
let current = pwd();
print("Current directory: " + current);
// Check if directory exists
if dir_exists("important_folder") {
print("Directory found!");
}
// Get file information
let info = file_info("document.pdf");
print("Size: " + info.size + " bytes");
print("Modified: " + info.modified);
// Search for files
let results = find_files("*.txt", "C:/Documents");
for file in results {
print("Found: " + file);
}
// Batch operations
let txt_files = list_dir("*.txt");
for file in txt_files {
let backup_name = file + ".backup";
copy_file(file, backup_name);
}
// Execute commands silently (no console window)
let result = exec("dir C:\\");
print(result);
// Run applications
exec("notepad.exe");
exec("calc.exe");
// Execute with arguments
exec("powershell.exe -Command Get-Date");
// Start processes in background
start_process("important_service.exe");
// Execute and capture output
let output = exec_capture("systeminfo");
print("System Information:");
print(output);
// Run elevated commands (if needed)
exec_admin("net user newuser password /add");
// Process multiple files
let files = list_dir("*.log");
for file in files {
// Compress each log file
exec("powershell.exe Compress-Archive -Path " + file + " -DestinationPath " + file + ".zip");
}
// Show information messages
show_message("Task completed successfully!");
// Ask for confirmation
let confirmed = confirm("Do you want to proceed?");
if confirmed {
print("User confirmed!");
}
// Get user input
let name = input("Enter your name:");
print("Hello, " + name + "!");
// Show warnings and errors
show_warning("This action cannot be undone!");
show_error("Failed to save file!");
// Display formatted content
let markdown_content = `
# Task Report
- **Status**: Complete
- **Files Processed**: 150
- **Time Taken**: 2.5 minutes
## Summary
All files have been successfully organized.
`;
render_markdown(markdown_content);
// Show progress to user
print("Starting file organization...");
let files = list_dir("Downloads/*");
let total = len(files);
for i in range(0, total) {
let file = files[i];
let percent = (i * 100) / total;
print("Progress: " + percent + "% - Processing " + file);
// Your processing logic here
process_file(file);
}
print("β
Organization complete!");
// Get environment variables
let home = env("USERPROFILE");
let path = env("PATH");
// Get SnapRun specific variables
let winscript_home = env("SnapRun_HOME");
let scripts_path = env("SnapRun_SCRIPTS");
// Use environment variables in paths
let documents = env("USERPROFILE") + "\\Documents";
// Get system details
let computer_name = env("COMPUTERNAME");
let username = env("USERNAME");
let os_version = exec_capture("ver");
print("System: " + computer_name);
print("User: " + username);
print("OS: " + os_version);
// Work with file paths
let full_path = "C:\\Users\\John\\Documents\\report.txt";
let filename = path_filename(full_path); // "report.txt"
let directory = path_directory(full_path); // "C:\\Users\\John\\Documents"
let extension = path_extension(full_path); // ".txt"
// Build paths safely
let user_docs = env("USERPROFILE") + "\\Documents";
let target_file = user_docs + "\\output.txt";
SnapRun includes 12 professional built-in scripts:
- Calculator - Interactive calculator with basic operations
- File Organizer - Organize files by extension
- File System Demo - Demonstrate file operations
- Hello World Test - Simple greeting and system info
- Log Manager - Rotate and compress log files
- Markdown Demo - Show markdown rendering capabilities
- Process Demo - Demonstrate process execution
- Quick Md Test - Quick markdown formatting test
- Simple Greeting - Basic user interaction
- System Diagnostics - System health and performance checks
- System Info - Detailed system information display
- Test Home Dir - Test environment variable access
- Location:
Documents\SnapRun\Scripts\ - Format:
.rhaifiles with standard Rhai syntax - Auto-Discovery: Scripts appear automatically when added
- No Compilation: Run directly from source code
- Debugging: Clear error messages and stack traces
// Use comments for documentation
// Script: File Backup Utility
// Author: Your Name
// Description: Backs up important files to external drive
// Configuration section
let source_folder = "C:\\Important\\Documents";
let backup_drive = "E:\\Backups";
let timestamp = exec_capture("powershell.exe Get-Date -Format 'yyyy-MM-dd'");
// Main script logic
print("Starting backup process...");
// ... your backup logic
// Try-catch style error handling
if file_exists("important.txt") {
try {
let content = read_file("important.txt");
print("File content: " + content);
} catch (error) {
show_error("Failed to read file: " + error);
}
} else {
show_warning("File not found!");
}
// Process multiple items
let extensions = ["*.txt", "*.doc", "*.pdf"];
for ext in extensions {
let files = list_dir(ext);
print("Found " + len(files) + " " + ext + " files");
}
// Numeric loops
for i in range(1, 11) {
print("Processing item " + i + " of 10");
// Your processing logic
}
// String manipulation
let filename = "Document_2024_Final.txt";
let clean_name = filename.replace("_", " ");
let upper_name = clean_name.to_upper();
let parts = filename.split("_");
print("Original: " + filename);
print("Cleaned: " + clean_name);
print("Parts: " + parts);
// File type processing
let file = "document.pdf";
let ext = path_extension(file);
switch ext {
".txt" => print("Text file detected"),
".pdf" => print("PDF document detected"),
".jpg", ".png" => print("Image file detected"),
_ => print("Unknown file type")
}
- Limited System Access: Scripts can only access approved functions
- No Direct Win32 API: Prevents dangerous system calls
- Controlled File Access: File operations are monitored and logged
- Process Restrictions: Only approved processes can be executed
- Silent Execution: Processes run without visible console windows
- Error Isolation: Script errors don't crash the application
- Resource Limits: Memory and execution time limits prevent runaway scripts
- Permission Checks: File operations respect Windows permissions
- Execution Logging: All script executions are logged
- Error Reporting: Detailed error messages for debugging
- Performance Monitoring: Track script execution time and resource usage
- Rust Backend: Native execution performance
- Compiled Engine: Rhai scripts are compiled to bytecode
- Minimal Overhead: Direct system integration without interpreters
- Efficient Memory: Automatic memory management with Rust
- Large File Handling: Process files of any size efficiently
- Batch Operations: Handle thousands of files without performance issues
- Background Execution: Run in system tray without impacting performance
- Resource Management: Automatic cleanup of temporary resources
- Glass Effects: Configurable transparency levels
- Color Schemes: Multiple accent color options
- Font Settings: Adjustable text size and font family
- Layout Options: Compact or expanded interface modes
- Global Shortcuts: System-wide keyboard shortcuts
- Customizable: Modify shortcuts to match your workflow
- Conflict Detection: Automatic detection of shortcut conflicts
- Context Sensitive: Different shortcuts for different application states
- Environment Variables: Customize paths and settings
- Script Directories: Add multiple script locations
- Startup Options: Configure application behavior
- Integration Settings: Control Windows integration features
Next: Getting Started | User Guide