Possible Template for Setting/Choosing My KM Data

In a previous topic, I suggested an organization for storing the user's KM data, like for Scripts, HTML, etc. See Proposed/Suggested Organization of Your KM Data

To use/enforce that proposed organization, I have the below macro, as an example, to confirm/set the My KM Data/Scripts folder.

  • This proposes the default of ~/Documents/My KM Data/Scripts
  • But allows the user to override this, and choose hisher own folder.

Is this pattern worth trying to get some type of concensus, or should we each just roll our own, as usual?

###Here's my imperfect pattern, dressed as a macro, for your consideration.
All suggestions for improvements and/or alternatives are very welcome.

It seems a bit verbose, but I don't see any means of simplifying it, offhand.
If you do, please advise.

The key tenets are:

  1. Proposes a standard location, but allows override
  2. Uses a naming convention for the KM variables
  • All of the "My KM Data" variables start with:
  • and then the folder type is appended, like Scripts_Folder
  • DND stands for "Do Not Delete"
  • The double underscore is used so that the DND__ does not show in Prompts
  1. The notion being that the same KM variable would be used in all Macros, and once the user selected a location in one, the same location would be available, and used, in all other macros

###Your thoughts?

###MACRO: Choose Folder TEST

Choose Folder TEST.kmmacros (8.0 KB)

I didn’t look at the details, 'cause I’m busy working on, well:

I’m close to releasing the first version of my Macro Import Manager (“MIM”), which is a KM Custom HTML GUI to assist in examining .kmmacros files, with several options including disabling triggers before importing, etc. and then importing the .kmmacros file, or only some of the macros in it if desired. More details later (I wasn’t ready to talk about it yet).

Once released, I was going to talk about us coming up with some standards so we could automate (via MIM) installing additional files like you’re talking about. Even letting the user decide where to put the files, and then have some convention for how MIM can tell the newly installed macro(s) where to find their files (probably via a variable, or else actual modification of the macro code prior to importing).

Anyway, as I said, I wasn’t ready to talk about the details, but you kind of forced my hand.

So as we talk about the standards you’ve mentioned in your post, let’s be considering whether it is possible to develop the automated system I’m talking about.

That sounds fine to me. Since you’re doing all the work, I’m happy to let you drive.
You have my organizational thoughts. Use them as you see fit to work with your system. I’m happy to discuss whenever you’d like.

@peternlewis - Short version: At some point we’ll want your thoughts on all this. You probably don’t have the time now, and that’s cool, but I want to make sure we aren’t planning something that will be drastically affected by any looming changes in KM that we don’t know about. Things like you having already decided to build this stuff into KM natively, and we’re wasting our time, etc. :slight_smile:

@JMichaelTX -

So, I had a chance to look at this, and there’s a lot I like. It’s kind of cool to know we were thinking along the same lines.

Take your time reading and responding to this. There’s no immediate rush for an answer. I’ve probably taken at least a half hour, more like an hour, composing this reply.

Let’s make sure we respond to each other when we have the time to really think, as opposed to when we’re rushed, when it would be easy to overlook something. If not for anything else, I’m reminding myself. :slight_smile:

A couple of small points, the some questions.

  1. Don’t we have some AS code for using a standard Choose Folder dialog? Any reason you didn’t use that? I have some ideas, but I’d rather hear it from you.

  2. I’d recommend displaying the error message in something other than a Notification - either “Display text in a window”, or use a Prompt. Otherwise it’s generally almost impossible to read the actual error message, since Notifications are so short. This is something I’ve started to do as a normal practice, anytime an error might give anything other than a short message.

  • One advantage of “Display in a window” (as opposed to “Prompt”) is that the text can be copied. A disadvantage is there’s no real Title, but you can always just have that be the first line, with a blank line afterwards.
  1. I like your error handler, and how you add a specific prefix to the front of the message. Much easier to determine if there’s an error or not.

  2. I’d also consider putting this code in a loop, so after displaying the error message, it brings up the dialog again, giving the user another chance at picking a folder (or canceling of course).

Now some questions:

  1. So let’s say I have a Custom HTML Prompt, and I need a place not only for my HTML file, but css and js folders as well. Would we use the variable set above as the base folder, then just add our own subfolders under it, like this?
  • %Variable%%DND__KM_Data_Scripts_Folder%/My Macro Name/…
  1. Even though the variable says “DO NOT DELETE” (even if it were completely spelled out), the user could delete it anyway. Might it be better to store this value in a plist file somewhere? I say plist file, because if we have one thing to store, we’ll eventually have more.
  • If this is a good idea, perhaps we could get Peter to suggest a location for the plist file? It would be nice to be able to include it in his user preferences so if things get migrated to another computer, this setting would go with it. But he’d have to approve that (obviously) and tell use exactly what to do and not do.
  1. Seeing your AppleScript for the folder picker makes me wonder if the code I’m writing for MIM should be in AS, to support older versions of OS/X? Then again, the latest version of KM requires at least 10.10, and that supports JXA, so perhaps I’m OK? Say yes, please…

Anyway, those are my thoughts. I really like what you’ve come up with.

I have no current plans. That said, the intention of the original Macro Library was for it to be live updated with user contributed macros, etc, so the original plans far outstretched the eventual implementation.

It is likely that any good results you get from whatever you implement would only make anything I eventually implement better in any event. But I have no current plans for anything in this direction.

But maybe I’ll take one look at whatever you cook up and think that would be a great addition :wink:


I’d say “that’s what I’m afraid of”, except I’m not. If anything we do contributes in the long run to a better KM, we’ve done our job.