Increment a Number in a Google Chrome URL and Then Load the Updated URL

Hello!

I'd like to know if it is possible with Keyboard Maestro to increment a number in the Chrome addressbar and then load the site?

e.g.
https://www.example.com/FlashCards?lessonNumber=1

I would like to increment this number 1 to 2, 3, 4 ... 30 and load the page everytime. The purpose for this is that I want to copy all the content into Excel where I can then easier learn the material.

Unfortunately, I could not find how to do this. I know of a batch downloader that would use an easy command like for this and it automatically goes through each number: https://www.example.com/FlashCards?lessonNumber=[1,30]

Is such a thing possible with Maestro?

Thanks

I have managed to figure it out using a hint from another post here. Here it is for anybody who needs to do something similar.

I just wonder, if there is a better/cleaner solution to this? I had to split the repeat for single digit numbers and duo digit numbers in order to use the backspace 1 time and 2 times.

Hi,

In stead of splitting your repeat, you can use shift-option-left arrow to select the last 'word' of the link.

But there might be someone more experienced with KM that can think of an even better way :wink:

Regards,
RenΓ©

1 Like

thanks a great tip! thank you

Hey @enigma2k,

Sure.

I was going to say it's pretty simple, but it's really not.

It is fairly easy if a bit tedious once you've learned how to do it, but until you understand the necessary actions and regex – it's a head-scratcher.

Read the notes in the macro for special instructions.

-Chris


Increment Google Chrome URL and Reload v1.00.kmmacros (9.7 KB)

2 Likes

@ccstone

Thank you, this is highly appreciated. Looks much better than what I came up with. I have to refresh my regex skills but this way it is even possible to pick a number if it is not at the end but also in the middle if you get the regex right. :slight_smile:

1 Like