TootRain and Automation

TootRain since 1.7.3 supports both AppleScript and Shortcuts.

Show status with AppleScript

You can find the availble commands from Script Editor. Here is an example of showing a status via AppleScript:

tell application "TootRain"
    show status "Hello world"
end tell

The body supports <img src=...> tag, you can also specify the avatar URL like this:

tell application "TootRain"
    show status "Hello<img src=\"\">world" avatar ""
end tell

Since OS X 10.10, scripting is also available in JavaScript, so you can write code like this:

TootRain = Application("TootRain")
TootRain.showStatus("hello", {"avatar":""})

Get statuses with AppleScript

You can also access current visible statuses via the status element.

tell application "TootRain"
    every status
end tell

This gives you an array of status, with the following properties

While there’s no API to get a script triggered when there’s a new status, it’s always possible to poll the status array. Here is an example of a script, automatically reading out the body whenever there’s a new status.

tell application "TootRain"
    set lastHandled to ""
        set allStatuses to every status
        if allStatuses's length is greater than 0 then
            set lastStatus to the last item of allStatuses
            if lastStatus's id is not equal to lastHandled then
                set statusBody to lastStatus's body
                say statusBody using "Kyoko"
                set lastHandled to lastStatus's id
            end if
        end if
        delay 1
    end repeat
end tell


Shortcut integration is much simpler, the only command supported is to show status on screen. The text option support <img src=...> tags, and the avatar option is optional.