KeyRoutines
StepFreelist.count

Count how many items are in a list inside a routine

Count list items tells you how long a list is and whether it's empty. It's the quick check before a loop, or the number you show at the end.

How it works

  • Pass a list from an earlier step or JSON text.
  • It returns the count and an is-empty answer.
  • An empty input counts as an empty list; something that isn't a list fails with a hint to use Split text for plain text.

Routines that use it

Nothing new

Count the results of List files and stop early with Stop routine when there are none.

Report a total

Show "Moved 12 files" in a banner using the count.

Pick a random item

Use the count as the maximum for Random number, then fetch that item with Get list item.

Settings

SettingWhat it does
ListThe list to count.

Questions

How do I check if a list is empty?
Use Count list items and check its is-empty result, or compare the count with 0.
Can it count lines of text?
Split the text into lines with Split text first; that step also gives you a count directly.

Pairs well with

Build this routine in KeyRoutines

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