Random responses with aText

If you're using Mac's software aText for text expansion you will probably like this little snippet.

You have to create it as a Shell Script and it allows you to print a random message every time you expand it.

#!/bin/sh # Keep this updated when you add or take away quotes on the case list num_greetings=4 # Generate a random quote number variable, 'rand' rand=$[ ( $RANDOM % $num_greetings ) + 1 ] case $rand in #BEGIN CASE 1) greeting="Hello, how may I help you?";; 2) greeting="Hi, how can I help you?";; 3) greeting="Hello, how can I help you?";; 4) greeting="Hello, what can I do for you?";; esac # END CASE # Display the random quote from case statement, and format it to line wrap at 80 characters echo $greeting
Code language: PHP (php)

Comments

    1. Hey Rodrigo,

      I don’t know, you should probably ask the developer of the app. Here’s a screenshot of my snippet, make sure to select “content Shell Script”

      Hope this helps!

      A Text

Leave a Reply

Your email address will not be published. Required fields are marked *