Bookmarklets/userscripts are such an excellent showcase of why the web is so empowering to users and why native apps are such a depressing, user-hostile regression.
Example from literally just this morning: I'm organizing an event and the venue wanted an attendee list in Excel format. The event is organized through meetup.com, which has been "app-ifying" their site for years now, which is to say, turning it to useless crap. I went to the list of attendees for the event and tried to copy-paste the 80-ish names so I could clean it up into a usable list... but some cabbage-brained PM has apparently decided that users shouldn't be allowed to copy-paste names out of the attendees list (literally all the text on the page except attendee names was selectable). Fortunately it was trivial to whip up a tiny script to circumvent this, and made me appreciate how annoying it would be to transcribe this all by hand if all I had was a useless locked-down mobile app.
Cases like this highlight the importance of having accessible OCR tools, such as the one in Windows PowerToys which I learned to love. With just a shortcut you can extract text from any window, effectively bypassing browser or app limitations.
I don't THINK there is a way to do it straight from the snipping tool, but someone correct me if I'm wrong.
Edit: Personally I use the paid Cleanshot app, which is not only great for OCR but all sorts of screenshots, videos, and annotations: https://cleanshot.com/ You just drag a box around the text, click "OCR", and it gets copied into your clipboard. I find it easier & faster than having to deal with Preview.
I don't THINK there is a way to do it straight from the snipping tool, but someone correct me if I'm wrong.
It can be done from the screenshot tool. Take the screenshot, and an icon will appear in the lower-right corner of the preview. Click that icon and it selects all of the text in the preview.
If you don't want all to select all of the text in the window, just select the text in the image the same way you'd select text in any other program.
I find it easier & faster than having to deal with Preview.
On Linux, I created a little script which uses maim to capture a user selected screen region, save that to a file, run tesseract, and dump the output to stdout. Since it is all digital (minus weirdo fonts) the OCR should be perfect.
On recent Macs, it's automatic in most programs, including Mail, Preview, Quickview, and others. Just hover your pointer over text in an image, and if the computer recognizes it, you get a text cursor so you can select the text. No extra software needed.
If it's a language you can't read, you can often ⌥click the selected text and it will be translated into the language of your choice.
It's in the last two versions of macOS. You can grab text off of pretty much anything (with text). I've occasionally found it annoying when I'm trying to drag and drop an image that contains text but it's very useful and seamless.
You can usually extract text straight from the DOM (barring special efforts to obfuscate it), it doesn't matter much if there's layers of opaque JavaScript generating it.
It's not about controlling the source code (though that certainly helps), it's about controlling the device. If this was a native app on Linux or even Windows, you could attach a debugger and do the same kind of things whether or not you had the source code. An iOS app, not so much.
> If this was a native app on Linux or even Windows, you could attach a debugger and do the same kind of things whether or not you had the source code.
Notably, though: for a certain value of "you" more narrowly scoped than the "you" capable of writing a few lines of JavaScript.
Nah. Most people can't even write the JavaScript and the ones who can learn that are also generally capable of learning the desktop equivalents.
If there was any difference in difficulty it would be purely arbitrary as a result of which one currently has easier to use tools to do what you're trying to do. A lot of these kinds of things can be done in a few lines of bash or PowerShell.
If there is any fundamental difference, it's that in traditional desktop applications everything is local and the inability to run without an internet connection is something you might complain about. Whereas for a browser you might be surprised if that was even possible, and then there will be things you can't do because you'd need data which is only on the server and is never supplied to the client, or run into rate limiters or be unable to do it privately because your activity generates logs on the server etc.
"Produce any arbitrary file from any arbitrary page, Pandoc-style" would be a nifty feature, but not one that I expect sites to provide. Instead, just give me access to the data, that's all I need and expect, and what used to be standard before mobile apps caused our standards to fall.
So I would download all 6 files, then write a script/app to fuzzy search/filter/transform those files as needed. No need to manually scrape using the web form!
For example, here is line 65457 from PMNLSTMN.ZIP. It seems the OP is interested in searching the last column and outputting the first column:
K202167|Cordis Corporation|...|N||Brite Tip Radianz Guiding Sheath
That's true, and I actually used that dump[1] and OCR to automate about 80% of this project. The manual data entry was only required for the 20% that couldn't be found automatically.
Since this was just to fill in the gaps, I figured there would be diminishing returns on re-implementing fuzzy search on the data, but adding shortcuts to my manual workflow took less time for a reasonable speedup.
It was a limitation of the web form the author mentioned[1]:
> The device and company names are not standardized, and may have abbreviations, acronyms, or plain old typos. The website's search functionality does not provide fuzzy string matching, so finding a device often takes some trial and error.
The Devices@FDA is a single search box, while the one the author used breaks out by field, more useful if you know exactly what company name, etc. you're looking for. Also, Devices@FDA searches both 510(k) and PMA's (the other 1%).
Author here! I didn't know about that Devices@FDA search, thanks for the tip!
My goal for this project is to create a free/open source website that enhances this 510k data based on the public data dumps. I'd be very interested in hearing about how you use the current website for work, and what improvements would be useful for you! My email is in my about page.
The major enhancement is to show predicate device information as a first-class property of each 510k, since right now the data is buried inside various PDFs.
I do this sort of thing a lot, for a bunch of websites I need to use for work. I make tables sortable with DataTables, add buttons, add important info, fix formatting, make things clickable, move things around, sometimes I add whole new UIs. I mainly use TamperMonkey, as I like the built-in editing more than ViolentMonkey (though it still has its problems).
"... it seems to be built from a 1995 tool called Adobe ColdFusion"
As an old guy I have to say the "here be dragons" tone of this phrase made me laugh. I never used it myself but there was a time when ColdFusion was huge.
I used to code ColdFusion, it was great! Really easy to understand and easy to build custom web sites. I saw it more as a framework than a launguage and it tried to push what a framework could do, making it's own browser widgets. Being Macromedia/Adobe they weren't very good and there were other limitations but you could also make use of it being Java under the hood. It was very popular with the US government and there are still a few (but decreasing) number of developers maintaining these old CF sites.
Don't know VM has a shortcut helper, good to know.
Also I highly recommend VM as your main userscript runner.
It's fully open-source unlike TM, its development is rapid despite having basically only two developers (use the beta version, if needed), and in my very rudimentary tests it runs faster than other competitors (which only makes a difference when you have 100+ scripts or very heavy ones, of course.)
i think there are some situations where this is a brilliant and perfect answer and none other answer will be better.
in a lot of cases, a job that restricts you from using industry standard web automation tools like puppeteer or playwright or whatever is also going to restrict you from installing browser extensions.
Example from literally just this morning: I'm organizing an event and the venue wanted an attendee list in Excel format. The event is organized through meetup.com, which has been "app-ifying" their site for years now, which is to say, turning it to useless crap. I went to the list of attendees for the event and tried to copy-paste the 80-ish names so I could clean it up into a usable list... but some cabbage-brained PM has apparently decided that users shouldn't be allowed to copy-paste names out of the attendees list (literally all the text on the page except attendee names was selectable). Fortunately it was trivial to whip up a tiny script to circumvent this, and made me appreciate how annoying it would be to transcribe this all by hand if all I had was a useless locked-down mobile app.