Increment Templated Service/PopClip update
I’ve updated the Increment Templated Service and PopClip extension. It’s a small update, but the tool is useful enough that I want to highlight it.
The Increment Templated Service and PopClip extension allow you to write text with placeholders, and then repeat that text multiple times, using the placeholders to make changes in each iteration.
For example:
Here's paragraph ##1..3##.
Becomes:
Here's paragraph 1.
Here's paragraph 2.
Here's paragraph 3.
It gets more complex, and you can define start/end points, increment values, use string arrays, and reference index numbers in each iteration. See the PopClip extension docs for a more detailed explanation (anything that works in the PopClip extension also works in the Service.)
The update that I’ve just released allows reference placeholders to contain more complex math equations. In an iteration, you can include ##x##
for a 1-indexed reference, or ##i##
for a zero indexed reference. Previously you could include one mathematical operator, e.g. ##i*10##
in the placeholder. Now you can include any mathematical expression, e.g. ##(i+5)*20/3##
. Not a big deal, and if I didn’t think this little tool deserved more attention, the update on its own wouldn’t be enough to prompt a post. But it’s one of those tools that you don’t use every day, but when you need it, it’s a timesaver. Worth having in your toolkit, either as a Service (Quick Action), or as a PopClip extension.
Just as a side tip, you can use %
as a modulus operator in equations, so getting even-odd numbering is as easy as ##i%2##
.
Last minute update
Shortly after writing this, I decided to add one more feature to the Service/extension. You can now specify an array of strings after a modifier, allowing insertion of strings based on an index. To do so, include a #
separator, followed by a comma-separated list of strings. They’ll be inserted based on the result of the index reference (zero-indexed, so 0 is the first element). For example:
div-##one,two,three,four,five##.##i%2#odd,even## {}
Becomes:
div-one.odd {}
div-two.even {}
div-three.odd {}
div-four.even {}
div-five.odd {}
You can also do parallel arrays:
hello ##mother,father,sister,brother##, you are a ##i#parent,parent,sibling,sibling##
Becomes:
hello mother, you are a parent
hello father, you are a parent
hello sister, you are a sibling
hello brother, you are a sibling
That should cover what few variations aren’t already handled.
Downloads for both versions below.
Increment Templated Service v3.0.2
Download Increment Templated Service v3.0.2
Repeats a selected block of text a specified number of times, replacing placeholders with the count of the current item with variable start and end numbers.
Published 07/01/12.
Updated 02/06/23. Changelog
Brett's PopClip Extensions v1.45.2
Download Brett's PopClip Extensions v1.45.2
A few PopClip extensions for Markdown writing and other useful tools
Published 11/30/14.
Updated 02/07/23. Changelog