A thought about the site's growing discussions of scripting


#1

Discussions of AppleScript, JXA, Objective-C, browser JavaScript, shell commands, and their support for each other are starting to overwhelm the normal flow of posts directly related to KM. Really, all this other stuff deserves a place on this site only because KM can invoke code in these other languages and environments (and a little bit in the other direction). (The discussion about Wrap() and unwrap() functions for easier AppleScript use of ObjC functions is just one of the very many examples to consider. A comment I made there led me to write this extended post here: “…a site for some serious multi-language scripting information, resources, and discussions”) I’d like to hear from @peternlewis about this apparent co-option, as well as from other people.

My take on this is that scripts enhance the power of KM so greatly, that it behooves us to help each other learn more about writing them even though script execution is just one over very kinds of macro actions. It is intriguing to see such an explosion of contributions about scripting that is showing up here, rather than being directed to sites or mailing lists devoted specifically to scripting or to individual scripting languages. I think is a strong testament to the great underlying power of KM, and we should thank @peternlewis for hosting these wide-ranging discussions.

I’ve said it in other posts and other places, but I’ll say it again: KM’s power and complexity approaches the level of an operating system. In addition to its vast repertoire of macro capabilities, because it supports external scripting it unifies all the scripting languages, the shell, programming application behavior, operating the Mac GUI, driving system behavior, and, by the way (:grinning:), keybindings and other triggers. It’s massive. I believe it to be by far the most sophisticated non-application software ever written for the Mac.


A proposal for a collection of resource pages
#2

Keyboard Maestro provides an extraordinary confluence of integrated resource – from Swift, the Shell, AppleScript and JavaScript, to all of the excellent and approachable pre-built atomic actions. If Peter is OK with it, for the moment, it’s forum does seem a particularly good place to record and discuss fairly eclectic inter-language or inter-resource snippets and macros.

Most scripts that I scribble up to solve some problem or eliminate some noise quickly find their home inside a KM macro. Perhaps this is why the About dialog calculates that it has already saved me 40172 years … (Now I have to decide what to do with them, of course).


#3

I wonder if it might not be a good idea to have a new Category?


#4

We already have tags to easily locate topics about each script language:


#5

The point is not to be able to sort out all the stuff about scripting (and by the way the list is missing Objective-C), but rather to move it all to another area of the site to avoid overwhelming the straightforward KM stuff.


#6

Yeah, I was just thinking about the “clutter” mentioned earlier. Personally, I’m fine with it. :slight_smile:


#7

Again, that is what tags are for.

We now have a good tag list, that, IMO, is better than any forum category could be. Have you checked out the list?

See KM Forum Tag List

Easily available from the main top menu:

And from the Menu Dropdown button:


#8

I must have a completely different conceptual framework for tagging, because my attempts to tag posts are successful probably less than 5% of the time. I posted many tags and added a few more later. I haven’t checked, but I don’t think many made it into the list.


#9

I don’t understand why you are insisting on tags for this. Tags are for filtering, categories are for separating. Why do we need categories at all? It’s like the Finder — we could do without it and just use tags, and there certainly has been movement in that direction over the years in various contexts, not just the Finder. Categories help even in searching: it’s hard enough constructing a search to find what you want on the forum, at least if you could limit it to an appropriate category your chances of success improve greatly.

The point is that many (most? nearly all? everyone except a few of us?) are probably not interested in anything to do with Objective-C, JXA, writing actions, or perhaps even much about AppleScript. If there is a purpose to categories, surely isolating these discussions would be an appropriate use.

Other Discourse forums I participate in, including the Discourse forum itself, have many more categories.

I suppose it’s worth thinking about the ways one could take advantage of the separation categories provide other than just being able to add “category:macro” to a search.


#10

These need to be alphabetized. If there were a way to do it it would also be good to group them into related topics. (All scripting tags, all GUI tags, all Mac application tags, etc.)


#11

Tags are more useful because more than one tag can be assigned to the same topic, whereas a topic can belong to only ONE forum category.

The way @peternlewis has designed the forum categories is for each category to represent a very broad classification.

So it is easy enough to search for what you want:

category:macro tag:jxa

will get you all of the JXA related macros.

I tend to agree with you on this, but the Discourse forum designers seem to think it is more important to present the tags most used first, and we have no way of changing that.

If you want an alphabetic list, go to the tags page, and click on sort by name.


#12

The scripting discussed here has pretty much all been related to applying the many different scripting languages to automating processes of some sort, and hence it is appropriate on this forum.

And I do agree there is a risk that all the scripting discussion is overwhelming for users just wanting to solve some simple problem, and that risk is not mitigated by Tags. It would be reduced somewhat if there was a Scripting category and the scripting discussion was confined to that category, but I don’t see how that would work since most scripting replies are replies to non-scripting specific questions of how to accomplish something. If I look at just the General category:

there are only a handful of topics that are really scripting-specific, the rest are topics asking how to do something that may or may not use a scripted solution.

As for a multitude of categories, I general find that more categories either requires significantly more maintenance in changing categories of incorrect choices, or significantly more education of the visitors (which I am not in favour of requiring) and tends towards problems of never quite being sure where things really belong.

For the most part, I think the value of the scripting knowledge shared on this forum outweighs the downside. And I presume novices looking at the forum a) won’t be reading every post and thus will skip long drawn out debates on scripting, and b) will be scanning through the general or macro category looking for something interesting, or c) will use search to find what they are after, or d) failing that will post a question.

Oh, and in an ironic twist, this topic itself belongs in the meta category, not the general category… :wink:


#13

Y, meta & y ironic. Apologies.


#14

Y, I forgot Swift


#15

For my part, I am probably a happy KM user largely because I can’t script. So when the solution to a question is a script I tend to feel we haven’t advanced our ability to wrangle with KM.

I perfectly understand that scripting provides more elegant/quicker/shorter solutions but, to adapt an analogy I started elsewhere, it’s like I’m taking a German class and people try to help out by making suggestions like “have you tried writing it in Spanish?” :slight_smile:

That said, I have been very happy copying mostly Apple-scripted solutions and hacking them about on my own (though JXA leaves me standing.)

I wouldn’t want to see the scripting discussions disappear and I’d love to see more focus on KM-wrangling sometimes… Is that having my cake and eating it?


#16

You would have both if scripting discussions were in a different category.


#17

This makes perfect sense. Access to scripting is key to complex automations, and it fills those gaps that Peter hasn’t thought of or isn’t interested in - such as very tight application integration. (We aren’t likely to see, say, a set of Evernote or TaskPaper actions.)

If you are uncomfortable with “just write this script”, please do feel free to ask if there’s a non-scripting approach that’s easier to manage, or if it’s possible to better “package” that script (some easy variables to fill out rather than editing a complex script).


#18

I’m a scripter and I agree with you. When building a KM macro, or suggesting solutions to others, I first try to design it using native KM Actions (non-script actions). In fact, I have lots of KM macros that I could have done in script, but I found it easier/quicker to do just using KM Actions.

Interest in scripting here in the KM forum seems to go in cycles. We seem to currently be in a period of high interest, but I suspect that will die down after a while.


#20

Astute observation from @Rather.

True, some things only scripting can do, so a big “thank you” to scripters here.

But plenty of scripts, I think, “KM alone could do that, or most of that, and a lot easier to modify and maintain, too.”

“To a hammer, every problem looks like a nail.”


#21

Here’s some reasons for script postings:

  1. To do something that KM can’t.
  2. KM could do it, but it would be either cumbersome, slow, or both.
  • For an example of slow, try iterating through all the lines of a text file (after reading the file into a KM variable, of course). Watch how slow it gets as the number of lines in the file increases.

IMO, almost all of the scripts posted in this forum are because of those reasons.

Or at least the belief that those reasons are true - I know that for me, I’ve sometimes posted a script answer because I didn’t know KM could do it, and do it just fine. But that’s not the case most of the time.