Help needed for getting a list about all Tokens that are or aren’t scriptable with either AppleScript or JXA & getting examples of gathering their information

Hello Folks :wave:

Continuing of the topic How to do If this macro was recently ran (< 2 seconds ago) do one thing, if not, do another thing on the base of the scriptability of Keyboard Maestro's Tokens with either AppleScript or JXA.

**Edit: **
After Getting replies by @peternlewis & @ComplexPoint (post 2 and 3 down below) I decided to point everyone reading this OP to the subject of this Topic.
Everything in this OP below these words is is all information I **already have and am aware of to use when doing scripting with tokens. This Topic was created to gather information on how why and when it is possible or not to use Tokens in Scripting. **

From the other topic Ive linked to, I know about the fact that all Tokens which contain Information about the Running Macro Instances (%ExecutingMacro%, %ExecutingMacroUUID%, %ExecutingThisMacro%, %ExecutingMacroThisUUID%, %ExecutingMacroGroup, %ExecutingMacroGroupUUID%, %ExecutingThisMacroGroup%, %ExecutingThisMacroGroupUUID%, %ExecutingInstance%, %ExecutingInstanceName% and %ExecutingInstances%) can ONLY be used when passed form using the native Set Variable to Text Action to any Scripting Action.

What I also am aware of that the %NamedClipboard% Token is very flexible when it comes to scripting. The creation of a new Named Clipboard at runtime as well as getting and manipulating its Contents on the fly can be done - even though the fact that the Manipulation of the contents can be a truly complex thing.
Maybe there is also a way getting the UUID of a particular Named Clipboard that was created at any time - Ive read something in the past about it here in this forum - but I don't remember the Topics or the context or anyone who was part of the discussion(s).

Another Token I am aware of how to use is the one Token which I believe is the most used one by all KM Users - the %Delete% Token.

It would be nice to get a help on this Topic.

Greetings from Germany


Yes, manipulating Named Clipboards is extremely complex - clipboards generally are expected to be used as an opaque chunk of data.

Nothing springs to mind.

There isn't really any other questions in any of what you wrote, other than the subject line. It's not documented which tokens are available when. Tokens that are based on macro information will generally only work within the macro, which excludes AppleScript. Basically, AppleScript is more or less equivalent to being a different macro instance, so anything that would not be accessible to a different macro execution instance would not be accessible to AppleScript.

It's not clear if your comment about the Delete token is meant to be a question.

It might be better to ask specific questions in specific topics.

and of course,
(though I may be missing the point of these questions)
your osascript interface to the Keyboard Maestro Engine (accessible from JS for Applications and AppleScript) includes a .processTokens method

Hello Peter :wave:

Thanks for diving in.

That is the reason why I created this topic … I need help from others to gather all this information because I have plans for maybe a tutorial series about scripting tokens - I am also working on a draft for the Wiki Scripting Pages & as I told you somewhere else that I want to have more backwards compatibility for my macros for other setups like my VMs this will be also a useful information.

The comment on the %Delete% Token is what it is - a comment. I thought that it clear what I want.

It is all about the topic it self

Greetings from Germany


Hello Robin (@ComplexPoint)

Thanks for pointing out the process tokens method …
If you’ve already read my reply to Peter you should get it that everything in the OP is information I allready have and am aware of to use in most scenarios.

There is no nested question in my OP.

It’s all about getting information on how, why and when it is possible or impossible to use which token.

Greetings from Germany