Change the [email protected] 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 [email protected] "Hello World!"
Change the [email protected] 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 [email protected] "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:[email protected]" | |
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?