How can I get styled text to variable

I have this table on a web page.

Screenshot 2023-06-07 at 3.06.00 PM

This is the output I want to be in the variable.

Screenshot 2023-06-07 at 3.08.29 PM

I can make this happen if I use Notes copy the table to the clipboard and then past to notes using the paste and retain format.

But can't get this to a variable with the formatting.

TIA Roger

"Get this to a variable" sounds more like part of an attempted solution than a goal in itself.

XY problem - Wikipedia

What are you actually aiming to achieve or produce with your macro ?

(Keyboard Maestro variables are plain text strings, but there may be another way of moving the formatted HTML or RTF ā€“ through the system clipboard, or via an HTML string, for example ā€“ to the destination that you have in mind)

2 Likes

This is a list showing members of a household found in a census record. I am trying to get this information from the census record to my genealogy database application.

Currently I am using a utility app that reads the information using ocr and then pasting that information to my genealogy app. I am trying to make it more accurate than the ocr and less of a manual effort.

The actual census record is found at ancestry.com so I can not give you a link unless you have an account.

Roger

After some more thought maybe I can store the information in a named clipboard until Iā€™m ready then paste it directly from the named clipboard to my genealogy app

2 Likes

You can format text to look a certain way on screen or in print, or you can format data to have a certain structure. Because you posted a screen shot it looked like you wanted the former, but I suspect you want the latter.

"Take this table copied from a web page and convert it to text, one line per row with columns as tab-separated fields."

So what's needed is examples of the "incoming" and "desired outgoing" data. That's difficult to get from your OP because, as you've found, the System Clipboard tries to transfer things between apps in the best way possible.

Much will depend on how the text is copied from the web page -- it sounds like Notes can convert that into tab-delimited text, but it may require a little more work in a KM macro.