Hi. I'm new to KM and I'd really appreciate some help from more seasoned users.
Apart from setting up a number of simple text expansion macros, I'm also setting up some templates for creating emails. So far, I've managed to get it to enter the recipients, tab to the subject line, enter a predetermined subject, tab to the main panel, and enter the body of text, all with one trigger.
However, many of my emails, which use essentially the same content every time, do have a few sections where the text varies. For example, the subject line might refer to an invoice number.
Is there some way that I can enter these variables into some kind of input box that would then insert them into the correct place in the email itself?
Check out "Prompt for User Input".
Here's an example:
You can use Dan's method, and you can enhance his method by placing multiple variables in the same prompt window, and giving them default values, which he didn't include in his example. And I think his way is the best way, but here's an alternative way to ask a user to confirm three sample values at once:
If you run it, it will show a window with the three values and let the user change those values, and the window will look like this:
Thanks for these suggestions. But I don't see how the responses get entered into the email. Or am I missing something?
We don't even know which email client you use, so how could we possibly write code for you?
It's much, much better if you show us your working code and ask us to modify it.
P.S. Sorry if my response sounds harsh. I think we want to help, but we need your help to be able to help you.
The suggestions above collect your "personalisation" data in Keyboard Maestro variables -- KM actions can later use the values in those variables when inserting text and similar. Or if you are using Apple Mail there's the "Send Mail Message" action.
If you haven't already, take a quick look at the manual, particularly the Quick Start section. That'll quickly get you up to speed on some of the terminology -- you'll be using "variables" and "tokens" a lot for this macro -- and an idea of where to look for more in-depth info later.
My apologies. I'm running KM v11.0.3 and an example of my macro is attached. In this case, I'd like to enter the Docket Code in the subject line.
Thanks.
But in what program?
Is this in the Mail app, Outlook, in your web browser (and, if so, which browser and what email service), something else?
Take a look at the manual, particularly the bits on variables and tokens. In this case you'll need to get your docket code from somewhere before you can use it in your macro -- this example will prompt for it, then include what ever you enter in the typed text. Try it with Text Edit or similar as the active application:
Docket.kmmacros (2.6 KB)
The first action prompts for your input and saves it in a variable called Local_docketCode
. The second action types out some text, interpolating what was stored in the Local_docketCode
variable using the text token %Variable%Local_docketCode%
.
Does that help?
I guess I have the choice of trying to solve the exact problem you've described (which Nige seems to have done) or I could try to solve the problem with the best possible solution. I'm not sure which one you want.
But to provide the best possible solution, I would need more information. Do you know in advance which dockets go with each email address? Are you able to manually set up a variable such as the following?
And if you can set up a variable like that, it would be possible to automate the entire process without needing any input from you. However in that case you would have to tell us which app you are using. KM code is usually app-specific.
I'm using Outlook, online in Microsoft 365. I do know the docket number in advance, I just need to enter it. And, in fact, I do generally have more than one field to enter, such as the docket number and an invoice number.
Apologies if I seem dense...it's because I'm new to all this!
Thanks a lot.
No need to apologise -- it was new to all of us once upon a time
Do you understand the Docket macro, above? How it "collects" the text you want to use and stores it in the Local_docketCode
variable, then uses that variable via the %Variable%
text token?
So all you have to do in your macro is add a "Prompt for User Input" action to get the data, and change your "Insert Text '[Docket code..." action to type:
%Variable%Local_docketCode% - Final Files
Once you have that working you can ask more questions in the "Prompt" and use those now-filled variables in the same way in the email and body (perhaps including their first name) fields of your email.
Thanks for your understanding! I think I've got it now. I experimented with the Prompt For User Input action and it worked fine if I entered text into the box. However, I have a KM text expander macro set up so that I can enter a 3 digit docket number and have it expand to the full name of the docket (which can e quite long). However, that doesn't work inside the text input box. Is that right?
Correct. That can't work.
I'll see if I can find the thread that explains why, and post it here.
Oh, that's a shame. I'll just have to input that text expansion in the final email before sending.
Thanks all for your help.
That may be one way to solve the problem, but there are always many ways to solve any problem.
Your text expansion must follow some "rules" -- all you have to do is apply the same rules to the value stored in your variable when, or before, you use it in the typing action.
So if the rule is "the 3-digit number is prefixed with Docket-000
and suffixed with and underscore then today's date in yyyy-mm-dd
format" then
Docket-000%Variable%Local_docketCode%_%ICUDateTime%yyyy-MM-dd%
Take a look at the "ICUDateTime" token to see how that last bits works.
These "rules" can be as complicated as you need to get the job done, and you can build the end result using multiple simple actions. So this does the same as the single action above:
As with writing any macro, the tricky bit is precisely defining what you want to do in the first place!