Skip to content

Instantly share code, notes, and snippets.

@alekhinen
Created July 21, 2015 18:54
Show Gist options
  • Save alekhinen/b3a112cfbb5cad70e6e2 to your computer and use it in GitHub Desktop.
Save alekhinen/b3a112cfbb5cad70e6e2 to your computer and use it in GitHub Desktop.
Programmatically send iMessage via GUI through Terminal
on run {targetBuddyPhone, targetMessage}
tell application "System Events"
tell application "Messages" to activate
tell process "Messages"
click menu item "New Message" of menu "file" of menu bar 1
set input to targetMessage as text
delay 1
keystroke targetBuddyPhone
keystroke return
keystroke tab
keystroke input
keystroke return
end tell
end tell
end run
@alekhinen
Copy link
Author

This will open up Messages.app and click through the UI to generate and send an iMessage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment