Scripting syntax

SMS Mac 3 is now a stand-alone application and AppleScript support is included in the app. SMS Mac 2 (the Address Book plug-in) was accompanied by the "SMS Mac Scripting Application".

SMS Mac allows you to send an SMS from AppleScript. The syntax is:

                     tell application "SMS Mac Scripting"
                           set account to "john.doe@mac.com"
                           set pin to "1234"
                           set logging to true
                           set report email to "john.doe@gmail.com"
                           set m to make new outgoing sms with properties {flash:false}
                           tell m
                                 set message to "Don't forget to go to the dry cleaner!"
                                 set recipients to {"+12345678900", "+1345678901"}
                                 set sender to "+14567890123"
                                 set delivery report to true
                                 set email receipt to true
                                 try
                                       send
                                 on error errMsg number errNum
                                       display dialog "Error: " & errNum & ". " & errMsg
                                 end try
                           end tell
                     end tell

Note: in SMS Mac 3 use the line : "make new document" instead.

All the details of the syntax are listed in the Scripting Dictionary. To see it, choose Open Dictionary... from the File menu in Script Editor and select SMS Mac or the SMS Mac Scripting application.

You can put a list of mobile numbers in the recipients attribute. The message will be sent to all the list members.

You can put an email address in the sender attribute. It is the equivalent of the Reply to Email preference. Replies to the SMS will then go to that email address.

You can get your SMS balance reading the balance attribute of the application object. Since the balance information is in the server response, execute this line after sending the SMS.

You don't need to put the account ID and PIN in the script. If the account info is absent it will be read from the Keychain. This allows you to share your scripts without giving out your account info. The line of code containing the logging statement, is only recommendable during the debugging of your script.

Important 1: make sure you run your script in your test cycle at least once and give the SMS Mac Scripting Application permission ("Always Allow") to access the Keychain. It needs to query your PIN code from the Keychain if you don't supply it in the script.

Important 2: unlike the SMS Mac Scripting Application (see below), the script will use all current SMS Mac preferences, including account ID and PIN. So, in principle, you do not have to set any preferences in the script.

Important 3: besides reading your account information (Account ID and PIN), the SMS Mac Scripting Application does not read any other preferences. So, you will need to set the sender property of the SMS explicitly in the script.

Tip: to test your script without sending an SMS put "--" in front of the send command.

Home Page
SMS Mac

Download
Download 

Requirements
Application:
macOS 10.13 and up
Send SMS Widget:
macOS Mojave and lower

Support
Help
Support