Last active
December 14, 2015 20:48
-
-
Save ELLIOTTCABLE/5145919 to your computer and use it in GitHub Desktop.
Tell her so. (= #AppleScript #nodejs #JavaScript #MacOSX #iMessage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cp = require 'child_process' | |
handle = 'imessage@somebody.tld' | |
message = 'I love you.' | |
interval = 15 | |
love = -> | |
osascript = cp.spawn 'osascript', [], {stdio: ['pipe', 1, 2]} | |
console.log '-- Spawning `osascript`' | |
osascript.stdin.write """ | |
tell application "Messages" | |
set theServices to every service whose name starts with "E:" | |
set theService to first item of theServices | |
send "#{ message } " to the the buddy "#{ handle }" of theService | |
end tell | |
""", -> | |
osascript.stdin.end() | |
setInterval love, interval *60*1000 | |
love() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment