I want to be able to grab all the text from the frontmost window on my screen, pipe it to a url parser and choose which url to open from the parsed text.
To do this I would need a way to access all textual contents of the frontmost window. I've come close by using applescript but I can't find a way to get the actual text. I'm suspecting that swift might be able to help, but I'm lost as to how to even google this, as most of my searches end up finding only trivial approaches like getting the url from a tab in chrome etc..
This is the gist of what I want:
tell the frontmost application
get contents of frontmost window as text
end tell