ShellLite is designed for automation. It gives you deep control over your files, desktop, and system operations.
Reading and writing files is incredibly simple, using natural language.
write "Hello World" to file "log.txt"Note: This overwrites the file.
append "New Entry\n" to file "log.txt"Adds to the end of the file.
content = read file "log.txt"
say content| Operation | Syntax | Description |
|---|---|---|
| Write | write "text" to file "path" |
Create/overwrite file |
| Append | append "text" to file "path" |
Add to end of file |
| Read | read file "path" |
Read file contents |
| Exists | exists("path") |
Check if file exists |
| Delete | delete("path") |
Remove a file |
| Copy | copy("src", "dest") |
Copy a file |
| Rename | rename("old", "new") |
Rename/move a file |
| List | listdir("path") |
List directory contents |
| Create Dir | mkdir("path") |
Create directory |
# Check if file exists before reading
if exists("config.txt")
config = read file "config.txt"
say config
else
say in red "Config file not found!"
# List all files in a directory
files = listdir("./documents")
for file in files
say file
# Create nested directories
mkdir("data/backups/2024")You can search file contents easily with regular expressions.
content = read file "server.log"
if content matches /Error/
say "Found an error in the log!"
if content matches /\d{3}-\d{4}/
say "Found a phone number pattern!"ShellLite can control your mouse and keyboard, allowing you to automate repetitive tasks.
Note: Desktop automation requires optional dependencies:
pip install keyboard mouse pyperclip plyer
# Type text
type "Hello, World!"
# Press special keys
press "enter"
press "tab"
press "escape"
# Key combinations
press "ctrl+c"
press "ctrl+v"
press "alt+tab"# Click at coordinates
click at 100, 200
# Move mouse
move to 500, 300Coordinates are X, Y pixels from the top-left of the screen.
# Copy to clipboard
copy "Important Data" to clipboard
# Paste from clipboard
text = paste from clipboard
say textSend native desktop notifications.
notify "Title" "Message body here"
notify "Backup Complete" "Your files have been saved."If you have a slow task (like downloading a large file), you don't want to freeze your whole program. Use spawn to run it in the background.
to download_large_file
wait for 5 seconds
give "Download Complete"
# Run in background
task = spawn download_large_file
say "Doing other work while downloading..."
# Wait for result when you need it
result = await task
say resultto fetch_user id
wait for 2 seconds
give "User " + str(id)
# Start multiple tasks
task1 = spawn fetch_user 1
task2 = spawn fetch_user 2
task3 = spawn fetch_user 3
say "All tasks started..."
# Wait for all results
user1 = await task1
user2 = await task2
user3 = await task3
say user1
say user2
say user3| Keyword | Description |
|---|---|
spawn |
Start a function in the background |
await |
Wait for a spawned task to complete |
Run code at specific intervals.
# Run every minute
every 1 minute
say "Checking for updates..."
check_for_updates()
# Run every few seconds
every 30 seconds
say "Heartbeat"You can download files directly from the web.
download "https://example.com/image.png"
download "https://example.com/data.zip"# For large files, use The Bridge
use "requests"
response = requests.get("https://example.com/large-file.zip", stream=true)
with open("large-file.zip", "wb") as f
for chunk in response.iter_content(chunk_size=8192)
f.write(chunk)
say "Download complete!"Manage .zip and other archive files.
# Compress a folder
compress "my_folder" to "backup.zip"
# Extract an archive
extract "backup.zip"
extract "backup.zip" to "destination_folder"# Compress multiple items
compress ["file1.txt", "file2.txt", "folder1"] to "archive.zip"
# Extract specific files
# (Use The Bridge for advanced options)
use "zipfile"Execute shell commands from ShellLite.
# Run a command
run "dir"
execute "ls -la"
# Capture output
output = run "git status"
say outputSecurity Warning: Be careful when running system commands, especially with user input. Always validate and sanitize inputs.
Access system environment variables.
# Using The Bridge
use "os"
# Get an environment variable
home = os.environ.get("HOME")
path = os.environ.get("PATH")
say "Home: " + homeControl external processes.
use "subprocess"
# Run and wait for completion
result = subprocess.run(["python", "--version"], capture_output=true)
say result.stdout
# Run in background (non-blocking)
process = subprocess.Popen(["long_running_script.py"])
# Continue with other work...
process.wait() # Wait when neededGet information about the system.
use "platform"
use "os"
say "OS: " + platform.system()
say "Version: " + platform.version()
say "Machine: " + platform.machine()
say "Processor: " + platform.processor()
say "CPU Count: " + str(os.cpu_count())Show progress for long operations.
# Simple progress
items = range(100)
for i in items
# Process item
progress i, 100 # Show progress bar
say "Complete!"to backup_files source_dir, backup_name
# Create timestamp
use "datetime"
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
backup_file = backup_name + "_" + timestamp + ".zip"
# Compress
compress source_dir to backup_file
say in green "Backup created: " + backup_file
backup_files "documents", "my_backup"to watch_folder folder_path
use "os"
last_files = listdir(folder_path)
forever
wait for 5 seconds
current_files = listdir(folder_path)
# Check for new files
for file in current_files
if not contains(last_files, file)
say in green "New file: " + file
notify "New File" file + " was added"
# Check for deleted files
for file in last_files
if not contains(current_files, file)
say in red "Deleted: " + file
last_files = current_files
watch_folder "./downloads"to generate_report
# Gather data
use "datetime"
now = datetime.datetime.now()
report = "# Daily Report\n"
report += "Generated: " + str(now) + "\n\n"
# Add system info
use "platform"
report += "## System Info\n"
report += "- OS: " + platform.system() + "\n"
report += "- Machine: " + platform.machine() + "\n\n"
# Add custom data
report += "## Status\n"
report += "- All systems operational\n"
# Save report
filename = "report_" + now.strftime("%Y%m%d") + ".md"
write report to file filename
say in green "Report saved: " + filename
generate_report()