I have a macro that Inserts text by pasting. The trigger happens when a string is typed. Example of string:
`kgi-hos-le-10:00-11:00
Is it possible for the output of the text to be dynamic and take each dash-separated part and produce text depending on that? In my example I have for the second part: "hos" which should translate into 3 separate chunks of text like this:
"hello world, ownership and system"
If I were to have more it would be intelligent to output every word basically listing whatever initials I type on that part. I would feed a list of mappings for each word (e.g. h= "hello world", etc.).
The same for the second part ("le").
The last part would be a date "between 10:00 and 11:00" kind of thing.
I can extend more, but I believe that I will be able to come up with the rest of this if it is even possible. I'm assuming I need some sort of script to make this happen?
EDIT: a bit more context on what I want o to achieve. I have a text template that I need to fill with at least 3 parts with dynamic strings. In the first part, I need to add a list of things (which could range from 1 to 10 following my above example), in the second part I need to add one of several sentences that depend on the set of characters I have on the second dash separator section and on the last part I need to have a date range.
If I input the example above:
`kgi-hos-le-10:00-11:00
I need to output:
There is something I need to do. I need to "hello-world, ownership and system". I believe "listening and ending" should sufice. This is to be done between "10:00 and 11:00".
as your trigger, and pop up a Custom Dialog to enter the other parts into KM variables? You could then use "Switch/Case" actions on each variable to build the string you want to insert.
If you are open to a slightly different approach, I think Keyboard Maestro would handle this in a simpler way by using a Prompt for User Input. In the Example Macro below I had the trigger as "qqq" but you can change that to any string you want such as your "`kgi-"
One advantage is there is nothing to remember apart from the initial trigger.
You could do it with typed triggers where it is a regular expresion.
So your type string could be `kig-.+
And then in your macro you use the token TriggerValue and evaluate it on what your text should insert.
Below is a macro I use to quickly write e-mails of my colleagues. Maybe you can use that as inspiration.
I either didn't read this bit in the manual, or didn't properly appreciate it... I've been thinking I wouldn't be able to do much with text expansions because I'd never remember them all, but this could really help me out.