Variables, text and data
Store values, format text, do maths, parse JSON and pass results from one step to the next.
Steps (26)
Add to date
Add to date moves a date forward by an amount you choose, from seconds up to years. Leave the date empty and it starts from right now, which makes "one week from today" a single step.
Time between dates
Time between dates measures the gap from one date to another in the unit you pick. Leave the later date empty to measure up to now, which is how you ask "how long since" or "how long until".
Format date
Format date writes a date as text in the layout you choose. It's the step behind dated file names, readable times in messages and timestamps in log files.
Read date
Read date turns text that holds a date into a real date the other date steps understand. It also hands you its parts, so you can check the weekday or month on their own.
Subtract from date
Subtract from date moves a date back in time by an amount you choose. With the date left empty it counts back from now, so "30 days ago" takes one step.
Count dictionary entries
Count dictionary entries tells you how many named entries a dictionary has. It also gives you separate lists of the names and the values, which is handy for going through them one by one.
Get dictionary value
Get dictionary value looks up one entry by its name. It's how you take a single setting or field out of a dictionary your routine built or received.
Remove dictionary key
Remove dictionary key gives you a copy of a dictionary without one entry. The original stays as it was, so earlier steps' results never change under you.
Set dictionary value
Set dictionary value adds an entry to a dictionary or replaces one with the same name. Leave the dictionary empty to start a fresh one, which is a simple way to bundle related values.
Add to list
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.
Count list items
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.
Get list item
Get list item takes one item from a list by its position. Use it to grab the first search result, the last line of a file, or a random pick from a list.
Remove from list
Remove from list takes items out of a list, either by matching a value or by position. You get a new list back and the original stays untouched.
Sort list
Sort list puts the items of a list in order, A to Z or Z to A. For lists of dictionaries, like file details, you can sort by one field such as name or size.
Remove duplicates
Remove duplicates keeps one copy of each value in a list and drops the repeats. It's the tidy-up step after collecting things from several places.
Calculate
Calculate works out a formula you type, like a price times 1.2 or a volume minus 10. Values from other steps go straight into the formula, so you can do real maths without a separate tool.
Random number
Random number picks a number between a smallest and largest value. By default it's a whole number from 1 to 100, like a dice with a hundred sides.
Round number
Round number tidies a number to the decimals you want. Choose nearest, always up or always down, for neat display or for steps that need whole numbers.
Change case
Change case rewrites text in upper case, lower case, or with a capital first letter. It's a quick fix for clipboard text, file names and anything that needs to look consistent.
Find with a pattern
Find with a pattern searches text with a regular expression and hands back what it found. It's how routines pull a code, a number or a link out of a longer piece of text.
Join list
Join list glues the items of a list into one text, with a separator of your choice between them. It's the opposite of Split text and the usual last step before showing or saving a list.
Read JSON value
Read JSON value finds one value inside JSON you already have, such as an API answer, copied text or a list or dictionary from an earlier step. Use it when you need one field out of a bigger answer. To read a JSON file on disk, use the Files pack's Read JSON value step.
Replace text
Replace text finds every occurrence of something in a text and swaps it for something else, or removes it. It works on clipboard text, file contents and step results alike.
Split text
Split text breaks one piece of text into a list. Split at commas, at line breaks or into characters, then loop over the parts or pick one out.
Trim text
Trim text cleans the edges of a text, removing spaces and line breaks from the start, the end or both. It's the quiet fix for copied values that don't compare the way you expect.
Encode for a web address
Encode for a web address turns text into a form that's safe inside a link, so spaces and symbols don't break it. It can also decode %XX codes in a link back into normal text.
How-to guides
- How to change your wallpaper automatically from a folder
- How to type today's date anywhere with a short abbreviation
- How to log when you open and close an app to a CSV file
- How to sort your Downloads folder automatically on Windows
- How to back up a folder to a dated zip file every day
- How to move new files out of a folder as soon as they appear
- How to save a quick note to a text file with a hotkey
- How to run something when a USB drive is plugged in
- How to get an alert when an app starts using your mic or camera
- How to get notified when your internet connection drops
Build this routine in KeyRoutines
Free from the Microsoft Store for Windows 11 and 10. Pro is a one-time upgrade.