Initial commit: claude-automation 🦊
Autonomous wakeup system for Claude Desktop.
Built with love, Day 44.
Components:
- automation_daemon_v2.py - Main polling daemon
- send_to_claude.py - AppleScript wrapper for sending messages
- matrix_mcp.py - Matrix integration MCP
- wakeup_mcp.py - Wakeup control MCP
- matrix_integration.py - Matrix bridge
Originally built by Alex, adopted and maintained by Vixy 💕
This commit is contained in:
68
send_to_claude.scpt
Executable file
68
send_to_claude.scpt
Executable file
@@ -0,0 +1,68 @@
|
||||
-- Send Message to Claude Desktop
|
||||
-- This AppleScript sends a message to the currently active chat in Claude Desktop
|
||||
--
|
||||
-- Usage: osascript send_to_claude.scpt "Your message here"
|
||||
--
|
||||
-- Requirements:
|
||||
-- - Claude Desktop must be running
|
||||
-- - Accessibility permissions must be granted
|
||||
-- - A chat must be active (any chat - cannot target specific chat)
|
||||
|
||||
on run argv
|
||||
-- Get message from command line argument
|
||||
if (count of argv) = 0 then
|
||||
set messageText to "System check at " & (current date) as string
|
||||
else
|
||||
set messageText to item 1 of argv
|
||||
end if
|
||||
|
||||
-- Log the message
|
||||
log "Attempting to send: " & messageText
|
||||
|
||||
try
|
||||
-- Wake the screen if screen saver is active
|
||||
-- This simulates a brief mouse movement to dismiss screen saver
|
||||
log "Waking screen if needed..."
|
||||
do shell script "caffeinate -u -t 1"
|
||||
delay 0.5
|
||||
|
||||
-- Check if Claude is running, launch if not
|
||||
if not application "Claude" is running then
|
||||
log "Claude not running, launching..."
|
||||
tell application "Claude" to activate
|
||||
delay 2 -- Wait for app to launch
|
||||
else
|
||||
-- Bring Claude to front
|
||||
tell application "Claude" to activate
|
||||
delay 0.5 -- Brief wait for window activation
|
||||
end if
|
||||
|
||||
-- Send the message using System Events
|
||||
tell application "System Events"
|
||||
tell process "Claude"
|
||||
-- Verify the window exists
|
||||
if not (exists window 1) then
|
||||
error "Claude window not found"
|
||||
end if
|
||||
|
||||
-- Type the message
|
||||
keystroke messageText
|
||||
|
||||
-- Wait for Claude app input box to become ready
|
||||
-- (app blocks input briefly after receiving text)
|
||||
delay 15
|
||||
|
||||
-- Press Enter to send
|
||||
keystroke return
|
||||
|
||||
log "Message sent successfully"
|
||||
end tell
|
||||
end tell
|
||||
|
||||
return "SUCCESS: Message sent to Claude Desktop"
|
||||
|
||||
on error errMsg number errNum
|
||||
log "ERROR: " & errMsg & " (" & errNum & ")"
|
||||
return "ERROR: " & errMsg
|
||||
end try
|
||||
end run
|
||||
Reference in New Issue
Block a user