If the site is a Tsunami warning I email my iPhone with the warning. It's a fairly simple idea, but it's not quite as easy as it sounds.
I have two different approaches to this problem.
The other approach is to use the macOS copy command to copy all the information from the page and then try to filter out the information I don't want (or filter in the information I do want.) This is difficult because (a) KM doesn't seem to have any actions which work on paste buffers that contain RTF data, and (b) the Shell in macOS doesn't have any filters that work on RTF data either.
Am I overlooking a feature of KM or perhaps a feature in the Shell that will help me filter out the data I need from the paste buffer? I often overlook features. (I did notice that the "Write to File" action allows me to save a paste buffer in its RTF format, but that doesn't help me solve the problem.)
If not, I would suggest a new action for KM that lets me do some basic filtering on RTF data. I would like to strip out (or strip in?) either tables, or pictures/objects, or text larger than (or smaller than) a certain size. Obviously there are many other things that an RTF filter could filter on but those are the things I would use.
P.S. I did find three websites that claim to email tsunami warnings for free, but I'm a programmer, so I want to do this myself.
The “Filter” action doesn’t have any filters for filtering out graphics, or tables, or font sizes, or anything like that. Or were you suggesting that I save the clipboard as an RTF and then use the regular expression features of KM actions to read the raw RTF formatting commands?
No there doesn’t seem to be a way to filter out images and such. But you should be able to filter out what you want to find with regular expression.
Of course, you will need to know ‘what’ you want to find in there.
You don’t have to save as rtf. Simply copy and then search through clipboard with the first action above.
Correct me if I’m wrong, but this should be possible.
Yes, that would work if I could get a list of all possible words for that site. But I doubt that’s possible. Each disaster is probably explained with unique words. Eg, “Pacific Tsunami Warning”; or “Possible Atlantic Tsunami.” Unpredictable. That’s why I want to filter based on character size. The words that I want to extract are always the largest words on the page. I may be forced to save it as an RTF and parse all those ugly RTF formatting strings. I’ve solved tougher problems than this before.
That’s a new lead, thanks. I know lots of UNIX commands but textutil is a new one to me. Looks interesting. This must be unique to macOS, as I think I would have noticed it on my work systems. It has lots of options some of which might actually help me here. Now I have homework to do.
You provided lots of ideas, which I will examine, and I appreciate. Simply converting from RTF to TXT was already understood and does not help me with my second idea of identifying the required text based on font size. I’m still looking for a way to filter text based on font information.
In my original post when I said “I did find three websites that claim to email tsunami warnings for free, but I’m a programmer, so I want to do this myself” that was one of the three sites I had found. Some of the sites charge money for their subscriptions (apparently SMS isn’t free). But the main reason I wanted to build my own solutions is that I’m a programmer and maybe I can do better than they can.