Apple Script - send "Message (with date/time?)" to imessagebuddy How do I get apple script to include the current time in an imessage sent with apple script?

on run {input, parameters}

    tell application "Messages"
        set iMessageService to 1st service whose service type = iMessage
        set imessagebuddy to buddy "mymessagebuddy@domain.com" of iMessageService
        send "Message" to imessagebuddy
    end tell
end run
Here is an example of how to add the time to the message:

set theTime to time string of (current date)

tell application "Messages"
    set iMessageService to 1st service whose service type = iMessage
    set imessagebuddy to buddy "mymessagebuddy@domain.com" of iMessageService
    send "Message " &amp; theTime to imessagebuddy
end tell


In the OP you said "to include the current time" but in your comment you said "to have current date/time", so if you want the latter, then use the following example instead:

set theDateTime to (current date) as string

tell application "Messages"
    set iMessageService to 1st service whose service type = iMessage
    set imessagebuddy to buddy "mymessagebuddy@domain.com" of iMessageService
    send "Message " &amp; theDateTime to imessagebuddy
end tell




By the way, if you plan on using AppleScript it would behove you to read the AppleScript Language Guide. You can get to it from: Script Editor > Help > Show AppleScript Language Guide

For reference to time string, it's shown under date under Class Reference in the AppleScript Language Guide.

For reference to current date, it's shown under Commands Reference in the AppleScript Language Guide.