A couple of thoughts the first is using MMM to save the web page as text and use a simple batch for loop (or powershell) to check the strings line by line. The second is use MMM to sequentially drill down each line of the web page, making use of the CLIPBOARD | TEXT CONTAINS function.
For this macro to work there must be some hard coded numbers. For example in my test the web page top where the text begins starts at X '847' and Y '90'. This macro slides down the web page selecting each line of string with a click and comparing it to find the text '100'. When it finds 100 it jumps to line 9 and runs some extra functions.
Line 1 - define integer as 90 (the start Y of the text on the web page) Line 2, 3, 4, 5 - left click the web page at the start of the line, then copy the line to the clipboard (shift+end & ctrl+c) Line 6 - if the clipboard contains the data '100' then goto line 9 and do some more stuff Line 7, 8 - add another 10 to the integer variable so it moves down the page as the Y value and then goto line 2 to begin the loop again.
1 | RUN ACTION | | | | DEFINE INTEGER VARIABLE | %INTEGER%::90 2 | 847 | %integer% | 500 | Left Click Down 3 | 847 | %integer% | 200 | Left Click Release 4 | 847 | %integer% | 500 | Keypress Shift+ | END 5 | 847 | %integer% | 500 | Keypress Ctrl+ | c 6 | IF | CLIPBOARD | VALUE | TEXT CONTAINS | 100 | GOTO MACRO LINE | 9 7 | RUN ACTION | | | | DEFINE INTEGER VARIABLE | %INTEGER%::+10 8 | RUN ACTION | | | | GOTO MACRO LINE | 2 9 | RUN ACTION | | | | MESSAGE PROMPT | Found:do stuff
Thanks Steve for taking the time to come up with the creative answers! I tried your macro but sometimes it is hard to make it work when the layout of the webpage is not very regular like a spreadsheet. I feel I definitely need to use the "search" function to find the key phrase first. After some research I found a Chrome extension "Vimium" which looks quite promising:
The "visual mode" seems to be the ticket to copy text out of a webpage, after the key phrase is searched with "/". In addition, the Vimium Chrome extension seems to be well suited for navigating a webpage and links in Chrome without using a mouse at all! I need to play around with Vimium more but it seems that it is an excellent companion to MMM when it comes to writing macros to work with webpages.
I am quoting the answer from k0pernikus
"As I am a user of vimium, it turns out I had the capabilities already shipped with it even though I wasn't aware that it existed.
Search the starting point by: /yourSeach Press enter. Enable visual mode via: v, and visual mode on a line basis via Shift + V Select text by vim navigation keys, aka: h, j, k, l, b, e, w, $ (I especially like shift + w, as it goes to the end of the next word) Yank via y You now can switch the context and paste the text via Ctrl+V
There also seems to be a caret mode, yet as of yet I somtimes don't see the current place of the cursor, which is why I prefer the search-first approach as of now. "
Acknowledgement: Ilya Sukhar, Phil Crosby and Stephen Blott are the developers of Vimium
Played around with Vimium & MMM more. It does have its limitations with MMM when u need to click on a link on a page.
1) I found the Vimium search key "/" sometimes doesn't work on some secure pages. So I explored the ctrl-f find key built into Chrome and it actually worked better for some web pages in which I needed to search for a link to click on it. i.e. ctrl-f, "type the search phrase", Escape, Enter.
To search and copy some text using Chrome's ctrl-f, try: ctrl-f, "type the search phrase", Escape, shift-right arrow to select more text, ctrl-c to copy
2) Clicking on a link using Vimium using the "f" command does not always work because the Vimium link mapping may change from time to time, making it difficult for any keyboard macro programming. A solution maybe to use the Chrome ctrl-f "search & escape" sequence instead.