Subroutine action to search rendered web page for text string


ChatGPT provided the following JavaScript code to search for rendered text in any web page. It works very well in a Keyboard Maestro action. But I would like to convert it into a subroutine action. I've been stuck on converting it into a subroutine for awhile now. This is probably something simple that I'm not getting.

Execute a JavaScript in Google Chrome Action (v10.2)

Execute a JavaScript in Google Chrome.kmactions (1.5 KB)

Thanks in advance.

Update: The syntax to get KM variable in my subroutine was incorrect, it was missing 'document'.,Using%20Keyboard%20Maestro%20Variables,-JavaScript%20in%20browsers

1 Like