What is the best way to keep a repository (personal library) of apple scripts which I use with KBM?

Hello, I am gradually accumulating AppleScripts which I use with KBM, and need to start creating some kind of a repository when I can easily see, comment, modify, paste into script editor for testing etc the scripts. I would like to start on the right foot.
I don't want to store the scripts in files and evernote is not ideal.
What is the best option ? Create a BBEdit project dedicated to scripts ?
thanks in advance for your time and help

I'm not sure what you mean by files… personally I store my AppleScripts as plain-text files with the extension .applescript which allows me to store them in GitHub, etc.

1 Like

I use SnippetsLab and I am very happy with it.

1 Like

What is your objection to files?

After having spent several years trying to find a really good script snippets manager (see What Do You Use for a Code Snippet Tool? (Jul 2015) ), I finally came to the conclusion that using macOS files, folders, and tags was/is the best solution for me.

For ease of access, here is my current system for managing scripts:

Well, it has now been 4 years since I made my OP, and much has changed.

  • I no longer use any of the above tools to manage my code/script snippets
    • I do continue to use Evernote to store and search for documentation of all types
  • My primary tool is storing all scripts as .scpt files, and using Finder Tags
    • Finder Tags provide a very powerful and easy to use Spotlight Search, both normal and search in the Finder.
    • The Finder provides a nice dropdown list of my tags when I save a file, and when I search for a file.
  • I also use Typinator to provide my most commonly used snippets
  • All of my standard functions/handlers are in Script Libraries, easily called from any script
  • I have a KM macro and script that allows me to easily search my Script Libraries, and insert either a call to the handler/function, or insert the full code of it.

For more details, see JMichaelTX Examples of Script System .

1 Like

I'd go with Github, free, private repositories. Can store anything you throw at it.

1 Like

damn, @tjluoma beat me to it.

@ronald give it a try, great way to keep repositories of anything you need to organize. It's focused on code, but also works for any kind of file you need to store. Plus, it has markdown support. And finally, it has version history, so there's no way to mess things up.

1 Like

Thank you. The issue, as I am sure you know, is that my scripts are constantly being modified and accompanying comments about the modifications. I don’t mean modifications with comments within the code, I also mean different ScriptS to perform the same action. I have difficulty envisioning how this would be possible with finder and tags.

A post was split to a new topic: Why Do Evernote Script Blocks Appear Differently?

Actually, storing scripts as compiled script (.scpt) files is the best and fastest way to use scripts with KM.

Execute AppleScript Action

In the KM Execute an AppleScript action, it is better to use the "Execute Script File" rather than "Execute Script Text":


  1. Compiled script file runs faster than script text
  2. You can reuse the same script file in many Macros, but have only ONE script to maintain.
  3. It is easier to open and edit a script file than the text in the KM Action
  4. You can also run the same script from other tools:
    • Apple Scripts menu
    • Fastscripts
    • Script Editor
    • Script Debugger 7+

Using the Finder to Store and Find Scripts

Since I have tagged all of my script files, it makes it very easy to find the script I want.
For example, if I want a script about Evernote, I search for the tag "SW.EN" in the Finder Find box:

When I select the TAG "SW.EN", I see these results:

I can easily filter this list by adding more criteria in the Finder Find box, including text that is INSIDE the file.
When I find the script file I want, it is easy to open in Script Debugger 7, or get the path to paste into the KM Execute Script Action.

Backup and Version Management

I achieve this by two means:

  1. All my script files are in my Dropbox folder on my Mac. Dropbox provides free 30-day backup, and you can purchase longer terms. So, I can restore a file from any prior date/time it was saved.
  2. Script Debugger 7+ also lets you easily restore a script file to a previous version, using a UI similar to Time Machine, only much easier.

Github is great for storing files, but, IMO, not so great for finding files.
IMO, the pain and overhead of learning and using Github for this use case make it not worthwhile.
Github is mostly for sharing files, although you can use it privately.

So the only benefit I see for private use of Github is backup and version management.
Dropbox provides both of those with no special effort.

1 Like

yes, I found Github's learning curve too steep and I use dropbox, so I will stick to your suggestions.
I am surprised you even mention Finder as opposed to Pathfinder. I never use the Finder search window and will look at it and will take a look at script debugger as well.
thank you very much for all the info.

Should am idiot with only very basic understanding of AppleScript use script debugger mainly to edit rather than write scripts, or should I stick to script editor ?

I use both PF and Finder. While PF also has a Spotlight search, I have found that I much prefer the UI of Finder Spotlight search.

1 Like

great to know !

@JMichaelTX I am intrigued by your suggestion to store source code in binary script files. I started out using SCPT files, but found them too limiting, so am saving as plain text and "building" to script files when necessary. You have much more experience with AppleScript so I would love to know how you get around the following issues.

  • As a software developer, I am frequently searching through files in a multi-file project, looking for a variable or function, or looking through old projects because I know I did the same thing I am attempting to do now. None of the tools I use can "see into" the binary format of script files
[~/src/applescripts (master) ]
paul-> grep "display dialog" *
My Display Utilities.applescript:	--display dialog current_resolution
Binary file My Display Utilities.scpt matches

Obviously Script Debugger can work with the binary format, but it does not seem to be able to search outside the current file. Am I missing this capability?

Script Debugger 7+ also lets you easily restore a script file to a previous version, using a UI similar to Time Machine, only much easier.

I may be completely missing this in the SD manual and menus, but I have no idea how to accomplish this!

Thank you for indulging me @JMichaelTX. I would love to use the native binary format, as manually building .applescript files and having SD windows with the same text in .applescript and .scpt is driving me to madness.

Why is this the best way to use AppleScripts with Keyboard Maestro?

The only format I use to save AppleScripts is the compiled format, .scpt, or .scptd.
I only use SD7, and I think it may save the plain text in the .scpt files, because I can quicklook all of my .scpt files, and Spotlight can search their contents.

For example, when I select a .scpt file in the Finder, and press SPACE to view the QuickLook, I always get a view like this:

If I do a Spotlight Search of "ReleaseNotes", you will see it find the above script, and several others that have the search term in their contents and/or in their file name:

But the most important thing I do is make sure I always assign the proper Finder Tags to my script files:


The Finder (with its Tag button, and in the Save dialogs) makes it very easy to search/select existing tags using incremental search.
For example, if I type "CAT." then I see a dropdown list of all of my "CAT", or Category, tags:

Finally, all of my standard AppleScript Handlers (functions) are in my Script Library, and I have a KM Macro that can search that Lib to make it easy to find the Handler of interest. Note that this also makes good use of "Text Tags", just plain text keywords with a "@" prefix:

So it is the combination of all of these things that make it very easy for me to store all of my AppleScripts as compiled script files and still quickly find what I need.


1 Like

I stated my reasons just below that statement:

Ah, okay, so "best" in terms of other user advantages, not best in terms of how Keyboard Maestro handles scripts, which was how the statement (unintentionally, I'm sure) could be read.

Wrong. How could you misread my clear statements: