on run {targetBuddyPhone, targetMessage, repeatCount} tell application "Messages" set targetService to 1st service whose service type = iMessage set targetBuddy to buddy targetBuddyPhone of targetService set myCount to repeatCount as integer repeat myCount times send targetMessage to targetBuddy end repeat end tell end run