Created
September 23, 2016 07:13
-
-
Save tk512/9b578739730eb5b83c7cbf502c38cf3a to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
# Can be used by your scripts to send iMessages from the shell | |
# Usage: | |
# ./SendMessage.sh 1234567890 'hi there!' | |
recipient="${1}" | |
message="${*:2}" | |
cat<<EOF | osascript - "${recipient}" "${message}" | |
on run {targetBuddyPhone, targetMessage} | |
tell application "Messages" | |
set targetService to 1st service whose service type = iMessage | |
set targetBuddy to buddy targetBuddyPhone of targetService | |
send targetMessage to targetBuddy | |
end tell | |
end run | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment