mirror of
https://github.com/samsonjs/Peekaboo.git
synced 2026-03-25 09:25:47 +00:00
🚀 Enhanced UX: Optional output paths with auto /tmp defaults
Major usability improvement making Peekaboo easier to use: • Output path now optional - auto-generates timestamped files in /tmp • Maintains full backward compatibility with existing scripts • Unified documentation approach (single peekaboo.scpt references) • Streamlined setup and examples in README • Enhanced user experience while preserving power user features Quick usage: osascript peekaboo.scpt "Safari" Result: /tmp/peekaboo_20250522_143052.png 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
b8dde8f824
commit
e234e192b3
3 changed files with 96 additions and 53 deletions
101
README.md
101
README.md
|
|
@ -1,9 +1,7 @@
|
|||
# 👀 PEEKABOO! 📸
|
||||
# Peekaboo—screenshot got you! Now you see it, now it's saved.
|
||||
|
||||

|
||||
|
||||
## 🎯 **Peekaboo—screenshot got you! Now you see it, now it's saved.**
|
||||
|
||||
👀 → 📸 → 💾 — **Unattended screenshot automation that actually works**
|
||||
|
||||
---
|
||||
|
|
@ -21,31 +19,37 @@
|
|||
|
||||
---
|
||||
|
||||
## 🎪 **TWO FLAVORS**
|
||||
## 🎪 **HOW TO USE**
|
||||
|
||||
### 🎯 **Peekaboo Classic** (`peekaboo.scpt`)
|
||||
*Simple. Fast. Reliable.*
|
||||
### 🎯 **Basic Usage**
|
||||
*Simple screenshot capture*
|
||||
|
||||
```bash
|
||||
# 👀 One app, one shot
|
||||
# 👀 Quick shot to /tmp with timestamp
|
||||
osascript peekaboo.scpt "Safari"
|
||||
|
||||
# 🎯 Custom output path
|
||||
osascript peekaboo.scpt "Safari" "/Users/you/Desktop/safari.png"
|
||||
|
||||
# 🎯 Bundle ID targeting
|
||||
osascript peekaboo.scpt "com.apple.TextEdit" "/tmp/textedit.jpg"
|
||||
```
|
||||
|
||||
### 🎪 **Peekaboo Pro** (`peekaboo_enhanced.scpt`)
|
||||
### 🎪 **Advanced Features**
|
||||
*All the power. All the windows. All the time.*
|
||||
|
||||
```bash
|
||||
# 🔍 What's running right now?
|
||||
osascript peekaboo_enhanced.scpt list
|
||||
osascript peekaboo.scpt list
|
||||
|
||||
# 👀 Quick shot to /tmp with timestamp
|
||||
osascript peekaboo.scpt "Chrome"
|
||||
|
||||
# 🎭 Capture ALL windows with smart names
|
||||
osascript peekaboo_enhanced.scpt "Chrome" "/tmp/chrome.png" --multi
|
||||
osascript peekaboo.scpt "Chrome" "/tmp/chrome.png" --multi
|
||||
|
||||
# 🪟 Just the front window
|
||||
osascript peekaboo_enhanced.scpt "TextEdit" "/tmp/textedit.png" --window
|
||||
osascript peekaboo.scpt "TextEdit" "/tmp/textedit.png" --window
|
||||
```
|
||||
|
||||
---
|
||||
|
|
@ -54,13 +58,20 @@ osascript peekaboo_enhanced.scpt "TextEdit" "/tmp/textedit.png" --window
|
|||
|
||||
### 🎯 **Basic Shot**
|
||||
```bash
|
||||
# Quick shot with auto-generated filename
|
||||
osascript peekaboo.scpt "Finder"
|
||||
```
|
||||
**Result**: Full screen with Finder in focus → `/tmp/peekaboo_20250522_143052.png`
|
||||
|
||||
```bash
|
||||
# Custom path
|
||||
osascript peekaboo.scpt "Finder" "/Desktop/finder.png"
|
||||
```
|
||||
**Result**: Full screen with Finder in focus → `finder.png`
|
||||
|
||||
### 🎭 **Multi-Window Magic**
|
||||
```bash
|
||||
osascript peekaboo_enhanced.scpt "Safari" "/tmp/safari.png" --multi
|
||||
osascript peekaboo.scpt "Safari" "/tmp/safari.png" --multi
|
||||
```
|
||||
**Result**: Multiple files with smart names:
|
||||
- `safari_window_1_GitHub.png`
|
||||
|
|
@ -69,7 +80,7 @@ osascript peekaboo_enhanced.scpt "Safari" "/tmp/safari.png" --multi
|
|||
|
||||
### 🔍 **App Discovery**
|
||||
```bash
|
||||
osascript peekaboo_enhanced.scpt list
|
||||
osascript peekaboo.scpt list
|
||||
```
|
||||
**Result**: Every running app + window titles. No guessing!
|
||||
|
||||
|
|
@ -79,7 +90,7 @@ osascript peekaboo_enhanced.scpt list
|
|||
|
||||
### 1️⃣ **Make Executable**
|
||||
```bash
|
||||
chmod +x peekaboo.scpt peekaboo_enhanced.scpt
|
||||
chmod +x peekaboo.scpt
|
||||
```
|
||||
|
||||
### 2️⃣ **Grant Powers**
|
||||
|
|
@ -94,7 +105,10 @@ chmod +x peekaboo.scpt peekaboo_enhanced.scpt
|
|||
Peekaboo speaks all the languages:
|
||||
|
||||
```bash
|
||||
# PNG (default) - crisp and clean
|
||||
# PNG (default) - auto-generated in /tmp
|
||||
osascript peekaboo.scpt "Safari"
|
||||
|
||||
# PNG with custom path
|
||||
osascript peekaboo.scpt "Safari" "/tmp/shot.png"
|
||||
|
||||
# JPG - smaller files
|
||||
|
|
@ -110,7 +124,10 @@ osascript peekaboo.scpt "Safari" "/tmp/shot.pdf"
|
|||
|
||||
### 🎯 **Targeting Options**
|
||||
```bash
|
||||
# By name (easy)
|
||||
# By name (easy) - auto path
|
||||
osascript peekaboo.scpt "Safari"
|
||||
|
||||
# By name with custom path
|
||||
osascript peekaboo.scpt "Safari" "/tmp/safari.png"
|
||||
|
||||
# By bundle ID (precise)
|
||||
|
|
@ -134,7 +151,7 @@ osascript peekaboo.scpt "Final Cut Pro" "/tmp/finalcut.png"
|
|||
|
||||
### 🔍 **Discovery Mode**
|
||||
```bash
|
||||
osascript peekaboo_enhanced.scpt list
|
||||
osascript peekaboo.scpt list
|
||||
```
|
||||
Shows you:
|
||||
- 📱 All running apps
|
||||
|
|
@ -148,15 +165,23 @@ Shows you:
|
|||
|
||||
### 📊 **Documentation Screenshots**
|
||||
```bash
|
||||
# Capture your entire workflow
|
||||
osascript peekaboo_enhanced.scpt "Xcode" "/docs/xcode.png" --multi
|
||||
osascript peekaboo_enhanced.scpt "Terminal" "/docs/terminal.png" --multi
|
||||
osascript peekaboo_enhanced.scpt "Safari" "/docs/browser.png" --multi
|
||||
# Quick capture to /tmp
|
||||
osascript peekaboo.scpt "Xcode" --multi
|
||||
osascript peekaboo.scpt "Terminal" --multi
|
||||
osascript peekaboo.scpt "Safari" --multi
|
||||
|
||||
# Capture your entire workflow with custom paths
|
||||
osascript peekaboo.scpt "Xcode" "/docs/xcode.png" --multi
|
||||
osascript peekaboo.scpt "Terminal" "/docs/terminal.png" --multi
|
||||
osascript peekaboo.scpt "Safari" "/docs/browser.png" --multi
|
||||
```
|
||||
|
||||
### 🚀 **CI/CD Integration**
|
||||
```bash
|
||||
# Automated testing screenshots
|
||||
# Quick automated testing screenshots
|
||||
osascript peekaboo.scpt "Your App"
|
||||
|
||||
# Custom path with timestamp
|
||||
osascript peekaboo.scpt "Your App" "/test-results/app-$(date +%s).png"
|
||||
```
|
||||
|
||||
|
|
@ -179,7 +204,7 @@ osascript peekaboo.scpt "Photoshop" "/content/after.png"
|
|||
### 👻 **App Not Found?**
|
||||
```bash
|
||||
# See what's actually running
|
||||
osascript peekaboo_enhanced.scpt list
|
||||
osascript peekaboo.scpt list
|
||||
|
||||
# Try the bundle ID instead
|
||||
osascript peekaboo.scpt "com.company.AppName" "/tmp/shot.png"
|
||||
|
|
@ -192,23 +217,24 @@ osascript peekaboo.scpt "com.company.AppName" "/tmp/shot.png"
|
|||
|
||||
### 🐛 **Debug Mode**
|
||||
```bash
|
||||
osascript peekaboo_enhanced.scpt "Safari" "/tmp/debug.png" --verbose
|
||||
osascript peekaboo.scpt "Safari" "/tmp/debug.png" --verbose
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🎪 **COMPARISON**
|
||||
## 🎪 **FEATURES**
|
||||
|
||||
| Feature | Classic 🎯 | Pro 🎪 |
|
||||
|---------|------------|--------|
|
||||
| Basic screenshots | ✅ | ✅ |
|
||||
| App targeting | ✅ | ✅ |
|
||||
| Multi-format | ✅ | ✅ |
|
||||
| **App discovery** | ❌ | ✅ |
|
||||
| **Multi-window** | ❌ | ✅ |
|
||||
| **Smart naming** | ❌ | ✅ |
|
||||
| **Window modes** | ❌ | ✅ |
|
||||
| **Verbose logging** | ❌ | ✅ |
|
||||
| Feature | Description |
|
||||
|---------|-------------|
|
||||
| **Basic screenshots** | ✅ Full screen capture with app targeting |
|
||||
| **App targeting** | ✅ By name or bundle ID |
|
||||
| **Multi-format** | ✅ PNG, JPG, PDF support |
|
||||
| **App discovery** | ✅ `list` command shows running apps |
|
||||
| **Multi-window** | ✅ `--multi` captures all app windows |
|
||||
| **Smart naming** | ✅ Descriptive filenames for windows |
|
||||
| **Window modes** | ✅ `--window` for front window only |
|
||||
| **Auto paths** | ✅ Optional output path with /tmp default |
|
||||
| **Verbose logging** | ✅ `--verbose` for debugging |
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -280,9 +306,8 @@ Built in the style of the legendary **terminator.scpt** — because good pattern
|
|||
## 🎪 **PROJECT FILES**
|
||||
|
||||
```
|
||||
📁 AppleScripts/
|
||||
├── 🎯 peekaboo.scpt # Classic version
|
||||
├── 🎪 peekaboo_enhanced.scpt # Pro version
|
||||
📁 Peekaboo/
|
||||
├── 🎯 peekaboo.scpt # Main screenshot tool
|
||||
├── 🧪 test_screenshotter.sh # Test suite
|
||||
└── 📖 README.md # This awesomeness
|
||||
```
|
||||
|
|
|
|||
|
|
@ -255,17 +255,24 @@ on run argv
|
|||
my logVerbose("Starting Screenshotter v1.0.0")
|
||||
|
||||
set argCount to count argv
|
||||
if argCount < 2 then return my usageText()
|
||||
if argCount < 1 then return my usageText()
|
||||
|
||||
set appIdentifier to item 1 of argv
|
||||
set outputPath to item 2 of argv
|
||||
|
||||
-- Use default tmp path if no output path provided
|
||||
if argCount >= 2 then
|
||||
set outputPath to item 2 of argv
|
||||
else
|
||||
set timestamp to do shell script "date +%Y%m%d_%H%M%S"
|
||||
set outputPath to "/tmp/peekaboo_" & timestamp & ".png"
|
||||
end if
|
||||
|
||||
-- Validate arguments
|
||||
if appIdentifier is "" then
|
||||
return my formatErrorMessage("Argument Error", "App identifier cannot be empty." & linefeed & linefeed & my usageText(), "validation")
|
||||
end if
|
||||
|
||||
if not my isValidPath(outputPath) then
|
||||
if argCount >= 2 and not my isValidPath(outputPath) then
|
||||
return my formatErrorMessage("Argument Error", "Output path must be an absolute path starting with '/'." & linefeed & linefeed & my usageText(), "validation")
|
||||
end if
|
||||
|
||||
|
|
@ -326,14 +333,17 @@ on usageText()
|
|||
set outText to outText & "Takes unattended screenshots of applications by name or bundle ID." & LF & LF
|
||||
|
||||
set outText to outText & "Usage:" & LF
|
||||
set outText to outText & " osascript " & scriptName & " \"<app_name_or_bundle_id>\" \"<output_path>\"" & LF & LF
|
||||
set outText to outText & " osascript " & scriptName & " \"<app_name_or_bundle_id>\" [\"<output_path>\"]" & LF & LF
|
||||
|
||||
set outText to outText & "Parameters:" & LF
|
||||
set outText to outText & " app_name_or_bundle_id: Application name (e.g., 'Safari') or bundle ID (e.g., 'com.apple.Safari')" & LF
|
||||
set outText to outText & " output_path: Absolute path for screenshot file (e.g., '/Users/name/Desktop/screenshot.png')" & LF & LF
|
||||
set outText to outText & " output_path: Optional absolute path for screenshot file" & LF
|
||||
set outText to outText & " If not provided, saves to /tmp/peekaboo_TIMESTAMP.png" & LF & LF
|
||||
|
||||
set outText to outText & "Examples:" & LF
|
||||
set outText to outText & " # Screenshot Safari using app name:" & LF
|
||||
set outText to outText & " # Screenshot Safari to /tmp with timestamp:" & LF
|
||||
set outText to outText & " osascript " & scriptName & " \"Safari\"" & LF
|
||||
set outText to outText & " # Screenshot Safari with custom path:" & LF
|
||||
set outText to outText & " osascript " & scriptName & " \"Safari\" \"/Users/username/Desktop/safari_shot.png\"" & LF
|
||||
set outText to outText & " # Screenshot using bundle ID:" & LF
|
||||
set outText to outText & " osascript " & scriptName & " \"com.apple.TextEdit\" \"/tmp/textedit.png\"" & LF
|
||||
|
|
|
|||
|
|
@ -497,10 +497,17 @@ on run argv
|
|||
end if
|
||||
end if
|
||||
|
||||
if argCount < 2 then return my usageText()
|
||||
if argCount < 1 then return my usageText()
|
||||
|
||||
set appIdentifier to item 1 of argv
|
||||
set outputPath to item 2 of argv
|
||||
|
||||
-- Use default tmp path if no output path provided
|
||||
if argCount >= 2 then
|
||||
set outputPath to item 2 of argv
|
||||
else
|
||||
set timestamp to do shell script "date +%Y%m%d_%H%M%S"
|
||||
set outputPath to "/tmp/peekaboo_" & timestamp & ".png"
|
||||
end if
|
||||
set captureMode to "screen" -- default
|
||||
set multiWindow to false
|
||||
|
||||
|
|
@ -524,7 +531,7 @@ on run argv
|
|||
return my formatErrorMessage("Argument Error", "App identifier cannot be empty." & linefeed & linefeed & my usageText(), "validation")
|
||||
end if
|
||||
|
||||
if not my isValidPath(outputPath) then
|
||||
if argCount >= 2 and not my isValidPath(outputPath) then
|
||||
return my formatErrorMessage("Argument Error", "Output path must be an absolute path starting with '/'." & linefeed & linefeed & my usageText(), "validation")
|
||||
end if
|
||||
|
||||
|
|
@ -624,13 +631,14 @@ on usageText()
|
|||
set outText to outText & "Takes unattended screenshots with multi-window support and app discovery." & LF & LF
|
||||
|
||||
set outText to outText & "Usage:" & LF
|
||||
set outText to outText & " osascript " & scriptName & " \"<app_name_or_bundle_id>\" \"<output_path>\" [options]" & LF
|
||||
set outText to outText & " osascript " & scriptName & " \"<app_name_or_bundle_id>\" [\"<output_path>\"] [options]" & LF
|
||||
set outText to outText & " osascript " & scriptName & " list" & LF
|
||||
set outText to outText & " osascript " & scriptName & " help" & LF & LF
|
||||
|
||||
set outText to outText & "Parameters:" & LF
|
||||
set outText to outText & " app_name_or_bundle_id: Application name (e.g., 'Safari') or bundle ID (e.g., 'com.apple.Safari')" & LF
|
||||
set outText to outText & " output_path: Absolute path for screenshot file(s)" & LF & LF
|
||||
set outText to outText & " output_path: Optional absolute path for screenshot file(s)" & LF
|
||||
set outText to outText & " If not provided, saves to /tmp/peekaboo_TIMESTAMP.png" & LF & LF
|
||||
|
||||
set outText to outText & "Options:" & LF
|
||||
set outText to outText & " --window, -w: Capture frontmost window only" & LF
|
||||
|
|
@ -645,14 +653,14 @@ on usageText()
|
|||
set outText to outText & "Examples:" & LF
|
||||
set outText to outText & " # List running applications:" & LF
|
||||
set outText to outText & " osascript " & scriptName & " list" & LF
|
||||
set outText to outText & " # Full screen capture:" & LF
|
||||
set outText to outText & " # Screenshot Safari to /tmp with timestamp:" & LF
|
||||
set outText to outText & " osascript " & scriptName & " \"Safari\"" & LF
|
||||
set outText to outText & " # Full screen capture with custom path:" & LF
|
||||
set outText to outText & " osascript " & scriptName & " \"Safari\" \"/Users/username/Desktop/safari.png\"" & LF
|
||||
set outText to outText & " # Front window only:" & LF
|
||||
set outText to outText & " osascript " & scriptName & " \"TextEdit\" \"/tmp/textedit.png\" --window" & LF
|
||||
set outText to outText & " # All windows with descriptive names:" & LF
|
||||
set outText to outText & " osascript " & scriptName & " \"Safari\" \"/tmp/safari_windows.png\" --multi" & LF
|
||||
set outText to outText & " # Interactive selection:" & LF
|
||||
set outText to outText & " osascript " & scriptName & " \"Finder\" \"/tmp/finder.png\" --interactive" & LF & LF
|
||||
set outText to outText & " osascript " & scriptName & " \"Safari\" \"/tmp/safari_windows.png\" --multi" & LF & LF
|
||||
|
||||
set outText to outText & "Multi-Window Features:" & LF
|
||||
set outText to outText & " • --multi creates separate files with descriptive names" & LF
|
||||
|
|
|
|||
Loading…
Reference in a new issue