macOS Shortcuts and "Combine Text"

Here’s something I’ve been struggling with. I’ve solved it now, but it took so long I thought I’d post it in case anyone else is battling the same problem.

macOS Monterey, Shortcuts.

I wanted to gather four pieces of text - one from the shortcut’s input, one chosen from a list, and two submitted by me through “Ask for Input” dialogue boxes.

I wanted to use “Combine Text” to create a single string, with the four inputs separated by a semi-colon.

Naively, I thought I could give Combine Text four variable names, tell it which separator I wanted to use, and get something useful out the other side.

This doesn’t work. I spent hours tinkering, reading help text, and scouring the web. I was about ready to give up.

Then I wondered if a List might be the answer. Turns out, if you setup a List object with the four variables you want to combine, Combine Text then takes it as an input and produces a sensible output.

Joy!

This stuff is probably obvious to most people, but it was driving me mad. Now, life is better.

You could add each of the text items into a single variable using Add to Variable which produces a list. Then use Combine Text against the list.

Example:
https://www.icloud.com/shortcuts/756c95d1520e4e75b255e6bc1b9fa533

1 Like

You could also put them together directly in a text step, referencing the magic variables for each of the inputs.

https://www.icloud.com/shortcuts/a4fe758a2b324a5b8bcf4329e60a67da

2 Likes

That’s nice - fewer steps, more elegant. Thanks, I like it!