Skip to content

Automation

Skippy provides desktop automation through two toolkits:

  • PowerShell Toolkit (skippy-tools.ps1) - System control and monitoring
  • AutoHotkey Integration (skippy-ahk.ahk) - Mouse, keyboard, and window control

PowerShell Toolkit

Loading the Module

Import-Module C:\Users\ejb71\SkippyBuddy\tools\skippy-tools.ps1

This message appears on load:

Skippy Tools loaded. Available commands:
  Screenshots: Take-Screenshot, Get-ScreenInfo, Get-MonitorInfo
  Apps: Get-RunningApps, Start-App, Stop-App, Focus-App
  System: Get-SystemStatus, Get-NetworkStatus
  Notify: Send-Notification
  Skippy: Get-SkippyStatus, Restart-Skippy
  Clipboard: Get-ClipboardContent, Set-ClipboardText

Available Functions

See PowerShell Toolkit Reference for complete documentation.


AutoHotkey Integration

Requirements

  • AutoHotkey v2 installed
  • Located at: C:\Program Files\AutoHotkey\v2\AutoHotkey64.exe

Basic Usage

$ahk = "C:\Program Files\AutoHotkey\v2\AutoHotkey64.exe"
& $ahk "C:\Users\ejb71\SkippyBuddy\tools\skippy-ahk.ahk" <command> [args...]

Commands

Command Description Example
click x y [button] Click at coordinates click 100 200
dclick x y Double-click dclick 500 300
move x y Move mouse move 0 0
type text Type text string type "Hello World"
send keys Send keystrokes send "{Enter}"
getpos Get mouse position getpos
activate title Activate window activate "Notepad"
wait title [timeout] Wait for window wait "Save As" 10

Examples

# Click at position
& $ahk tools\skippy-ahk.ahk click 500 300

# Type text
& $ahk tools\skippy-ahk.ahk type "Hello from Skippy"

# Send keyboard shortcut
& $ahk tools\skippy-ahk.ahk send "^s"  # Ctrl+S

# Activate window
& $ahk tools\skippy-ahk.ahk activate "Notepad"

# Wait for window then activate
& $ahk tools\skippy-ahk.ahk wait "Save As" 10

Key Syntax

AHK key notation:

Symbol Meaning
^ Ctrl
! Alt
+ Shift
# Windows
{Enter} Enter key
{Tab} Tab key
{Esc} Escape key
{F1}-{F12} Function keys

Examples:

^c       → Ctrl+C
^v       → Ctrl+V
!{F4}    → Alt+F4
^+s      → Ctrl+Shift+S
#{r}     → Win+R
{Enter}  → Enter

See AHK Integration Reference for complete documentation.


Common Automation Tasks

Opening Applications

# Via PowerShell toolkit
Start-App -Name "notepad"
Start-App -Name "code" -Arguments "C:\project"

# Via Windows Run dialog
& $ahk tools\skippy-ahk.ahk send "#{r}"
Start-Sleep -Seconds 1
& $ahk tools\skippy-ahk.ahk type "notepad"
& $ahk tools\skippy-ahk.ahk send "{Enter}"

Window Management

# Focus existing window
Focus-App -Name "notepad"

# Via AHK
& $ahk tools\skippy-ahk.ahk activate "Notepad"

# Wait for window
& $ahk tools\skippy-ahk.ahk wait "Untitled - Notepad" 5

Closing Applications

# Graceful close
Stop-App -Name "notepad"

# Force kill
Stop-App -Name "notepad" -Force

# Via AHK (Alt+F4)
& $ahk tools\skippy-ahk.ahk activate "Notepad"
& $ahk tools\skippy-ahk.ahk send "!{F4}"

Text Entry

# Type in active window
& $ahk tools\skippy-ahk.ahk type "Hello, World!"

# Type with special keys
& $ahk tools\skippy-ahk.ahk type "Line 1{Enter}Line 2"

# Paste from clipboard
Set-ClipboardText -Text "Content to paste"
& $ahk tools\skippy-ahk.ahk send "^v"

Mouse Operations

# Get current position
& $ahk tools\skippy-ahk.ahk getpos

# Move and click
& $ahk tools\skippy-ahk.ahk move 500 300
& $ahk tools\skippy-ahk.ahk click 500 300

# Right-click
& $ahk tools\skippy-ahk.ahk click 500 300 right

# Double-click
& $ahk tools\skippy-ahk.ahk dclick 500 300

Workflow Examples

Screenshot, Analyze, Report

# Take screenshot
$screenshot = Take-Screenshot -AllMonitors -Scale 0.4

# Get status
$status = Get-SystemStatus

# Notify
Send-Notification -Title "Status Check" -Message "CPU: $($status.CPU), Memory: $($status.Memory)"

Open App and Configure

# Open Notepad
Start-App -Name "notepad" -Wait

# Wait for window
& $ahk tools\skippy-ahk.ahk wait "Untitled - Notepad" 5

# Type content
& $ahk tools\skippy-ahk.ahk type "This is a test document.{Enter}{Enter}Created by Skippy."

# Save
& $ahk tools\skippy-ahk.ahk send "^s"

System Health Check

# Get comprehensive status
$sys = Get-SystemStatus
$net = Get-NetworkStatus
$apps = Get-RunningApps | Select-Object -First 5

# Report
@"
System Status Report
--------------------
CPU: $($sys.CPU)
Memory: $($sys.Memory)
Disk C: $($sys.DiskC)
Uptime: $($sys.Uptime)
Internet: $($net.Internet) ($($net.Latency))

Top 5 Apps by Memory:
$($apps | Format-Table ProcessName, Memory | Out-String)
"@

Automation Best Practices

Use Waits

Always wait for windows/apps to open before interacting:

Start-App -Name "notepad" -Wait
# or
& $ahk tools\skippy-ahk.ahk wait "Window Title" 10

Check Before Acting

Verify state before automation:

if (Get-Process -Name "notepad" -ErrorAction SilentlyContinue) {
    Focus-App -Name "notepad"
} else {
    Start-App -Name "notepad"
}

Error Handling

Wrap automation in try-catch:

try {
    & $ahk tools\skippy-ahk.ahk activate "Unknown Window"
} catch {
    Send-Notification -Title "Error" -Message "Window not found"
}

Timing Matters

Add delays between actions when needed:

Start-Sleep -Milliseconds 500


Security Considerations

Automation Risks

  • Automation can perform destructive actions
  • Always verify commands before running
  • Be careful with keyboard/mouse control in sensitive apps

Skippy's Safeguards

  • Commands require explicit user initiation
  • No automatic execution without chat interaction
  • All actions are logged