Change the you@icloud.com email to the address you use for iMessage.
and call the script with the first parameter being the recipient and the second one being your message, for example:
$ ./imsg someone@icloud.com "Hello World!"
Change the you@icloud.com email to the address you use for iMessage.
and call the script with the first parameter being the recipient and the second one being your message, for example:
$ ./imsg someone@icloud.com "Hello World!"
#!/bin/bash | |
if [ -z "$1" ] || [ -z "$2" ] ; then | |
echo "Usage: imsg [address] [message]" | |
else | |
/usr/bin/osascript -e 'tell application "Messages" | |
send "'"$2"'" to buddy "'"$1"'" of service "E:you@icloud.com" | |
end tell' | |
echo "Sent" | |
fi |
Thank you for this script, but it's giving me the following
26:117: execution error: Messages got an error: Invalid key form. (-10002)
Any ideas how to fix it?