Curious if it's possible to save to an array without initializing the array?
In "Event Speaker Variables (Working)" I tried to save into the 1st index of an empty variable, but this just leads to an empty variable.
In "Event Speaker Variables" I was able to get things working, but only by saving variables initially, then appending to those variables in a while loop.
Is there an elegant solution, or am I on the right path by appending into an array that I first initialize.
What I'm looking to do is create an array of first names, last names, email addresses, etc for our event speakers so that I can quickly register on behalf of them in Eventbrite. The # of speakers changes for each event, so I wanted to create a Macro that would ask for the # of speakers, create an array of their contact information, so that in another Macro I can loop pasting in all of those values.
MyDev Macros.kmmacros (14 KB)
Yes. But in the Set Variable to Text action you need to check the "Append to variable" option in the Gear menu:
I think there is a better solution, depending on how you need to paste the results into your web site.
IMO, it is generally better to create a tab-delimited (or comma-delimited) list that has one record on each line/row.
IAC, here is an example macro to help get you started.
It does the following:
- Builds a KM Global Variable of tab-delimited data like this:
First Name\tLast Name\tCompany Name
- Allows you to start a new list, or append to an existing list
- Outputs to:
- KM Display Text window
- System Clipboard, ready to paste into Excel or other spreadsheet
Below is just an example written in response to your request. You will need to use as an example and/or change to meet your workflow automation needs.
Changes You Need to Make
- Modify the Prompt for User Input to change/add the speaker data fields you want
- Make these same changes in the Actions below it
Please let us know if it meets your needs.
The System Clipboard is also set to this same tab-delimited list, suitable for pasting into Excel or other spreadsheet.
MACRO: Build Tab-Delimited List in a Loop [Example]
~~~ VER: 1.0 2020-02-22 ~~~
Requires: KM 8.2.4+ macOS 10.11 (El Capitan)+
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))
DOWNLOAD Macro File:
Build Tab-Delimited List in a Loop [Example].kmmacros
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.
- Build Tab-Delimited List in a Loop
NOTICE: This macro/script is just an Example
- It is provided only for educational purposes, and may not be suitable for any specific purpose.
- It has had very limited testing.
- You need to test further before using in a production environment.
- It does not have extensive error checking/handling.
- It may not be complete. It is provided as an example to show you one approach to solving a problem.
- KM 8.0.2+
- macOS 10.11.6 (El Capitan)
Carefully review the Release Notes and the Macro Actions
- Make sure you understand what the Macro will do.
- You are responsible for running the Macro, not me.
- Assign a Trigger to this maro.
- Move this macro to a Macro Group that is only Active when you need this Macro.
- ENABLE this Macro.
REVIEW/CHANGE THE FOLLOWING MACRO ACTIONS:
- ALL Actions that are shown in the magenta color
USE AT YOUR OWN RISK
- While I have given this limited testing, and to the best of my knowledge it will do no harm, I cannot guarantee it.
- If you have any doubts or questions:
- Ask first
- Turn on the KM Debugger from the KM Status Menu, and step through the macro, making sure you understand what it is doing with each Action.
Thanks for all this. I definitely like the idea of having each record on a line. I’m trying to prevent variable bloat as my use of KM increases.
PS just subscribed to your YouTube channel.