I want to make a macro that will get a number located in the same spot from 10 different websites and track the change in the number. I already set up a little code that can do one website, get the number and put it in a variable, but I wish I could just make a loop that runs through a code and puts in a new website each time and sets the number to the correct variable. However, when I try to use the “For each item in the loop…” and get to the website part, it’ll paste every website instead of one at a time. Also, I don’t know how to match the website # to the correct variable. If anyone could help, it would be greatly appreciated!
Hey Dozzy,
It would be helpful to see an example of the websites and the specific values.
In any case I’d try getting the source of the page with cURL and seeing if I could parse out the value I wanted reliably.
Run this in the Terminal to get an idea of how it works. (You can change Google to the URL for your site.)
curl -Ls --user-agent 'Opera/9.70 (Linux ppc64 ; U; en) Presto/2.2.1' --url "https://www.google.com"
Then I’d look for the value you’re wanting in the web-inspector in Safari or Chrome and see how hard it was to find.
You have Keyboard Maestro’s own search tools.
You have anything that will run from the shell at your disposal like Perl, Python, Ruby, or JavaScript.
If you can remove the web browser from the process it will be much more efficient.
-Chris