A comprehensive project to test and explore the Terminator Python SDK for desktop automation with fun examples, advanced workflows, and AI-powered automation!
- Install dependencies:
pip install -r requirements.txt
- For AI features, install and start Ollama:
# Install Ollama (see AI_SETUP.md for details)
ollama serve
ollama pull llama3.2
- Run the interactive playground:
python play_menu.py
play_menu.py
- Interactive menu to choose automation demos (now with AI options!)
play_paint.py
- Automate MS Paint to create digital artplay_file_explorer.py
- Navigate folders and organize filesplay_advanced_calc.py
- Advanced calculator with scientific functionsplay_workflow.py
- Multi-app workflows combining multiple applications
ai_simple.py
- Beginner-friendly AI automation (AI stories + calculator help)ai_automation.py
- Advanced AI agent with smart workflow planningAI_SETUP.md
- Complete setup guide for AI features
example.py
- Simple demo for beginnerstest_final.py
- Comprehensive working test suite
test_basic.py
- Basic functionality testtest_working.py
- Simple working exampletest_async.py
- Async version testrun_all_tests.py
- Master test runner
The key to using Terminator SDK is wrapping your code in an asyncio event loop:
import asyncio
import terminator
async def main():
desktop = terminator.Desktop()
desktop.open_application('calc')
await asyncio.sleep(2) # Wait for app to load
seven = desktop.locator('name:Seven')
seven.click()
asyncio.run(main())
Combine AI with desktop automation for intelligent workflows:
import asyncio
import ollama
import terminator
async def ai_automation():
# 1. AI generates content
response = ollama.chat(model='llama3.2', messages=[
{'role': 'user', 'content': 'Write a fun story about robots'}
])
# 2. Automate desktop to use the content
desktop = terminator.Desktop()
desktop.open_application('notepad')
await asyncio.sleep(2)
editor = desktop.locator('name:Edit')
editor.type_text(response['message']['content'])
asyncio.run(ai_automation())
- Event Loop Required: The SDK requires an asyncio event loop to be running, even though the methods aren't async
- Package Name: Install with
terminator-py
(not justterminator
) - Version Tested: terminator-py 0.3.7
- Windows Support: Designed primarily for Windows desktop automation
- AI Features: Requires Ollama for local AI models (see
AI_SETUP.md
)
- Desktop instance creation
- Application launching (
calc
,notepad
,mspaint
,explorer
) - Element location and clicking
- Text input and form filling
- Multi-application workflows
- Scientific calculator functions
- Memory operations
- Paint tool selection and drawing
- File system navigation
- Real-time documentation generation
- Art creation in Paint with automated documentation
- Calculator results → Notepad reporting
- File organization with summary generation
- Cross-application data transfer
- AI content generation → automated typing
- Intelligent task planning and execution
- Dynamic workflow creation
- AI-suggested automation sequences
- Smart problem-solving assistance
The SDK supports various selector patterns for finding elements:
# By name
desktop.locator('name:Seven')
# By role
desktop.locator('role:Button')
# By automation ID
desktop.locator('automationid:CalculatorResults')
# By window title
desktop.locator('window:Calculator')
# Chained selectors
desktop.locator('window:Calculator').locator('name:Seven')
# Select brush and draw
brush = desktop.locator('name:Brush')
brush.click()
red = desktop.locator('name:Red')
red.click()
canvas = desktop.locator('window:Paint')
canvas.click() # Draw!
# Scientific mode
menu = desktop.locator('name:Menu')
menu.click()
scientific = desktop.locator('name:Scientific')
scientific.click()
# Square root of 16
desktop.locator('name:1').click()
desktop.locator('name:6').click()
desktop.locator('name:Square root').click()
# AI suggests math problems
prompt = "Give me 3 calculator problems to solve"
response = ollama.chat(model='llama3.2', messages=[
{'role': 'user', 'content': prompt}
])
# Parse and execute automatically
expressions = extract_math_expressions(response['message']['content'])
for expr in expressions:
await calculate_expression(desktop, expr)
# Calculate in calculator
desktop.open_application('calc')
# ... perform calculations ...
# Document in notepad
desktop.open_application('notepad')
editor = desktop.locator('name:Edit')
editor.type_text("Calculation results: ...")
- "no running event loop" error: Wrap your code in
asyncio.run()
or run within an async function - Element not found: Use Windows Accessibility Insights or FlaUInspect to find correct element names
- App launch delays: Add
await asyncio.sleep(2)
after opening applications - Paint/Explorer issues: Element names may vary by Windows version
- "Connection refused": Make sure
ollama serve
is running - "Model not found": Run
ollama pull llama3.2
to download models - Slow AI responses: Try smaller models like
llama3.2:1b
- Import errors: Install with
pip install ollama langchain langchain-ollama
- 8+ automation scripts showcasing various capabilities
- 2 AI-powered automation demos with intelligent task generation
- Interactive menu system for easy exploration
- Comprehensive test suite for validation
- Real-world workflow examples
- Creative automation demos (art, calculations, file management)
- Multi-application coordination examples
- AI integration examples for intelligent automation
- Run
python play_menu.py
to explore all demos - Try modifying the scripts to automate your own workflows
- Explore other Windows applications
- Create your own custom automation scripts
- Set up Ollama following
AI_SETUP.md
- Run
python ai_simple.py
for your first AI automation - Try
python ai_automation.py
for advanced AI workflows - Experiment with different AI models and prompts
- Create your own AI automation agents
- Combine multiple applications for complex workflows
- Build AI agents that plan and execute automation tasks
- Create intelligent assistants for daily computer tasks
- Explore integration with other AI services and APIs
- Desktop Automation: Terminator SDK
- AI/LLM: Ollama (local models)
- AI Framework: LangChain
- Async Support: Python asyncio
- Models Tested: Llama 3.2, Llama 3, Qwen2
Welcome to the future of intelligent desktop automation! 🤖✨
This project demonstrates how AI can be seamlessly integrated with desktop automation to create intelligent, adaptive workflows that can understand, plan, and execute complex tasks autonomously.