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.
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.
A couple of small points, the some questions.
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.
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.
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.
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:
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?
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.
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