Create a New Macro While Executing a Macro

Hi Everyone,

I have the following issue: I have a macro for creating a new contact. By running this macro folders are created for this client and lots more.

The one thing that is missing is the automatic creating of a either a TextExpander or Keyboard Maestro shortcut that gives me those information, for example: "1234/0001 A vs B (Tax)". This text, I always use in the heading of my emails, or in the heading of documents in this matter.

What I am looking for is to also create the shortcut, when entering those above mentioned things in creating a folder structure for the new client.

For example: I set up a new client with the number 1234, with the case number 0001, with the client being A and the other party involved being B. So far I am using TextExpander. When I press "#client/matter" (eg. #1234/0001), I will provide me the full name and matter "1234/0001 A vs B (Tax)".

Is there a way how I can make Keyboard Maestro to set up a new macro when pulling the string #%variable_client%%variable_matter%? Alternatively, I would be happy to have this done for TextExpander.

Thanks for you help guys.

According to this old (2011) blog entry it should be possible to create a snippet using AppleScript.

I don't have TextExpander, so can't test this, but the first sample looks like something that should be easy to test.

Hope this helps,


Hey @michael_e,

See these posts:

Macro to Create a Text Expansion Macro from the Selected Text - @peternlewis

Macro to Create a Text Expansion Macro from the Selected Text - @reboot81

This is a few years old, but hopefully it will still work with the current version of TextExpander.

# Auth: Christopher Stone
# dCre: 2016/06/17 10:26
# dMod: 2016/06/17 10:26 
# Appl: TextExpander
# Task: Make a New Snippet
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @TextExpander, @Typinator, @Make, @New, @Snippet

tell application "TextExpander"
   properties of groups
end tell

tell application "TextExpander"
   set theGroup to first group whose name is "Test_Group"
   tell theGroup
      set newAbbreviation to "nuts; "
      set snippetText to "Whose nuts?"
      set newSnippet to make new snippet ¬
         with properties {abbreviation:newAbbreviation, plain text expansion:snippetText, abbreviation mode:ignore case} ¬
   end tell
end tell


Another couple of examples:



Wonderful. Thanks a lot. I assumed there was an easier solution, but happy the Marco works!

1 Like