Created
April 12, 2017 18:41
-
-
Save andermoran/9f4bfb245f9498a7105b53b63a57cbb8 to your computer and use it in GitHub Desktop.
Revisions
-
andermoran created this gist
Apr 12, 2017 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ #!/bin/sh USAGE=$'Usage: imessage <number> <text>\nExample: message 9121231234 \"Hello!\"' if [ "$#" -ne "2" ]; then echo "$USAGE" exit 1; fi exec <"$0" || exit; for i in {1..12} # Reads the first x lines of the program do read v done exec /usr/bin/osascript - "$@"; exit # Interprets the following lines as AppleScript 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