Let’s say you have a snippet you want to share with others. The bulk of the snippet is boilerplate text or a script, but there’s at least one variable part. Here are two examples of how we use nested snippets to make that work at Smile.
We share several standard support signatures. Here’s one we use when providing support for TextExpander:
Thanks for using TextExpander from Smile! Regards, %snippet:myname% TextExpander Support http://smle.us/support
The signature snippet is in a read-only group, since we want to make sure the team has matching signatures. But the snippet “myname,” nested in the middle of the signature snippet, needs to be different for each team member. Each member creates and stores his or her own “myname” snippet in an editable local group. The nested snippet with abbreviation “sigsup” is the supplemental info shared across all of our support signatures and might include new product announcements or other special information. It’s not user-specific, so it comes along with the main read-only snippet group.
Bit.ly Authentication Details
Long ago, we used to recommend that users duplicate the Internet Productivity Group, then there was a spot at the top where users could plug in their Bit.ly login and API key. One day, I realized that we could use the same technique as the name in our signature for that, so I re-wrote that snippet, and now it starts with:
set my_Login to "%snippet:my_bitly_login%" set my_API_Key to "%snippet:my_bitly_API_key%"
This is followed by some code to return instructions on how to set up your own snippets with abbreviations of “my_bitly_login” and “my_bitly_API_key” to make this work. It’s no longer necessary to duplicate the group and delete the original. You just choose File -> Add Predefined Group -> Internet Productivity Snippets, then you set up your own snippets for your login and API key, which get nested into the main snippet.
Nested Snippets Are Awesome
These are just two examples of how you can create standard snippets to distribute broadly which incorporate one or more variables in order to function. Have a great story about how you use nested snippets? Write us and let us know.