Newbie question: How to parse current YEAR, MONTH and DAY into URL to open

Hi, I'm completely new to Keyboard Maestro.
I'd like to create a macro that opens my gmail as a 'Yesterbox', showing all the emails in my inbox that came in before today. Today, on April 1st, the URL would be:

How can I parse the current YEAR, MONTH and DAY into this URL? Any help is appreciated!


KM uses the ICUDateTime token to specify time so you want that.

Something like:
Keyboard Maestro Export

Notice how I inserted '/'s in there and it didn't effect anything. You can insert anything so long as it's not a reserved character.

Here's the same thing with each value separated:
Keyboard Maestro Export

That may be more useful when building a URL.

Lots to play around with to fit it exactly how you need it.


Thank you @kraftyDevil !

1 Like

You can extend @kraftyDevil's suggestion by building a variable that includes the entire search string as you would see it on the Gmail page, e.g.,

in:inbox before:2022/4/1

Then use the Filter action to percent-encode that string and prepend the

bit to it. The only difference between your example and the result will be a %20 instead of a + between inbox and before. But that's a valid encoding of the space character and the URL will work fine.

Here's a sample macro that creates the URL and displays it in a window. If you download and install it, it will be in a Keyboard Maestro folder called Temporary.

Gmail URL.kmmacros (3.0 KB)

Image of macro


@drdrang Thanks for your kind help