The KM Variable Token is simply returning the value of a KM Variable. It could have been a function getVariable("myVarName")
, and in fact, I suspect internally the Objective-C software is using just such a function (method).
I see no distinction between KM Tokens and KM Functions, other than that KM Functions have been arbitrarily limited to returning numbers.
So, Peter, I understand you needed some way to identify a function call in the plain text of a KM action, so you labeled them "Tokens". They could have been called functions, simply delimited by "%" characters to so identify. For example, we have both a CALCULATE() function and a %calculate%
token.
I think a lot of the confusion about KM Tokens comes from the understanding most of us have of the general use of a token to represent a fixed value of money.
From Token Definition & Meaning - Merriam-Webster
a : a piece resembling a coin issued for use (as for fare on a bus) by a particular group on specified terms
b : a piece resembling a coin issued as money by some person or body other than a de jure government
Given that common understanding, it is easy to see why the term "token" is confusing for something like %WindowFrame%1%
, which actually varies in its return value, according to which window is currently frontmost.
I don't believe I have ever heard or seen the term "token" associated with the example you gave in processing mail merge lists. "Placeholders" or "fields" are the terms I've seen used.
Moving Forward
Be that as it may, the concrete has been poured, and we have the term "Token", for better or worse.
The thing that concerns me now is how to clearly define this term, especially for those users with little or no programming experience. This is what led me to the analogy of "functions", since so many users world-wide are likely to have used Excel, and its functions. They understand the notion of a function returning a value, or of having an output.
I just reread the KM Wiki on Tokens :
Tokens allow you to add textual information to token text fields. You can tell that a field accepts tokens because a small T shows in the field while editing it.
For example, %SystemClipboard%
will be replaced by the text in the clipboard.
It is no wonder many are confused about Tokens. I think I clearly understand the term, but that statement confuses me.
- "add textual information" -- what a mouthful just to say Tokens only return text
- "token text fields" -- first rule in definitions: never use the term in defining the term.
Of course, it is also confusing to say that Token only return text, when a window frame is clearly made up of numbers. LOL
So, we clearly have our work cut out for us to rewrite the Wiki Tokens page and make it very clear to all.
I'm make a first draft, and submit it for all to review and comment on.