KeyRoutines
StepFreelist.add

Add an item to a list at the start, end or any position

Add to list puts one item into a list. It's how a routine collects things as it goes, like file names found in a loop or answers to several questions.

How it works

  • Choose the list (empty starts a new one) and the item, which can be text, a number or an earlier result.
  • Put it at the end, the start, or a position; positions count from 1 for the first and -1 for the last.
  • It returns the new list and how many items it has, and leaves the original list alone.
  • A list can come from an earlier step or be typed as JSON text like ["a", "b"].

Routines that use it

Collect big files

While going through List files, add each large file name to a list and show them with Join list.

Recent searches

Add each search term to the start of a remembered list before opening it with Web search.

Build a menu

Add options to a list and offer them with Choose from a list.

Settings

SettingWhat it does
ListThe list to add to. Keep empty to start a new list.
ItemThe item to add: text, a number, or a value from an earlier step.
AtWhere to put it.
PositionIts position in the new list: 1 for the first, -1 for the last.

Questions

How do I build a list in a loop?
Inside a Repeat, use Add to list with the previous round's list as input and save the result with Set variable each time.
Does position 1 mean the first item?
Yes. In these steps 1 is the first item and -1 is the last.

Pairs well with

Build this routine in KeyRoutines

Free from the Microsoft Store for Windows 11 and 10. Pro is a one-time upgrade.