I have macros (such as a recent one created by @tiffle and many others by him and other forum members) which have instructional value in addition to solving an immediate problem.
In those macro, I create a comment entitled "Teaching". I was wondering is there is a way of listing the content of those comments so I can create some kind of personal teaching library.
thanks in advance for your time and help
Basically, no.
Maybe you could process all the actions through AppleScript (or the plist macro file) and find all the comment actions and then search that, but there is definitely no way to do it within the editor.
It's pretty much beyond mine too.
It is, as @peternlewis suggests, possible by employing AppleScript (maybe Javascript) and I already have a macro that could be used as a starting point…
What I have in mind is a macro that goes through all your macros and for each one that has a comment as either its first or second action (there is a reason for that!) it extracts at the least the comment title and text and the macro UUID for later use.
Now there are a couple of points to note:
- The macro would take time to run - the larger the number of macros you have the longer it would take. It might only be a few seconds but it would be enough to be annoying if it happened every time you wanted to perform a search.
- “for later use” needs some thinking about: how and where would the extracted information be stored/presented/searched/filtered?
Based on these two points in my opinion the macro I’ve been talking about would be best run once every so often (manually or on a periodic basis) in order to index so to speak your collection of macros; the result of the indexing would be stored in a file/spreadsheet/database. You would then use another macro or app to search through the index and produce the searched-for information and that would be a very fast operation.
This then brings me to this question: what do you want to do with the result of the search? Do you just want to read it? Or maybe have the ability to examine the one or more macros that have been found by the search operation? Would the indexing macro need to have created and saved images of all your macros so you can examine those instead of opening up the actual macros in the KM editor?
I’m now getting a little worried that this is actually potentially much more complex a task depending on what you wish to do. All comments welcome!
how about limiting the search to a smart group ? The percentage of teaching macros is infinitesimal compared to the total number.
Results . clipboard would be fine.
thank you
If I remember correctly from a post last week, as of right now, AppleScript can’t search through smart groups, however Peter has indicated that this will be a capability in the next major version.
Just tinkering with a bit of AppleScript I noticed that the contents of the Comment
action are in styled text - which is not readily searchable unless it is first converted to plain text. (Good luck with that!)
However, as always, JMichaelTX is smiling down on us having foreseen this need and he posted his approach in this thread:
I've just tried out his macro and it does work and perhaps with a little fine tuning @ronald it can be made to work for you...
Try it out to see how it fits your needs.
For me it works, Thank you!
Comments are useful for reminders about what actions and macros do, for crediting creators of macros and so on. I do not think they are well suited to being notes for a personal knowledge management system, which is what I imagine your "personal teaching library" to be.
May I suggest that you keep notes about each macro in a in a text file, or better still a PKM application. If you use, for instance, Obsidian, you can even have links between separate notes.
I think you would find such a ready reference convenient, easy and useful, and you wouldn't have to try to make Keyboard Maestro do something it's not designed for.
a very good point. thank you. In fact I am trying to create some kind of index which has nothing to do with KBM.