TheJoeFin / Text-Grab

Use OCR in Windows quickly and easily with Text Grab. With optional background process and notifications.
https://www.microsoft.com/en-us/p/text-grab/9mznkqj7sl0b?cid=TextGrabGitHub
MIT License
3.33k stars 223 forks source link

How to use this repo as Text Extractor in PowerToy #497

Open zydjohnHotmail opened 4 days ago

zydjohnHotmail commented 4 days ago

Hi, I can use Text Extractor in PowerToy for my Windows 11 PC. However, in order to use it, I have to install OCR for Windows but I think it is necessary, but I have to install PowerToy, which has a lot of features, which are not necessary for my project. I want to know if I want to write one WinForms project and try to grab text from an area of my PC screen, like: start point (100, 100) with size of (200, 50) pixels, then run C# code to recognize the text in that area using the OCR installed for PowerToy. Please show me a sample code for this job, so I don't have to install PowerToy to do this. I am using Visual Studio 2022 version 17.12.1 on Windows 11 (Version 23H2 OS build 22631.4541) Thanks,

TheJoeFin commented 4 days ago

The PowerToy Text Extractor is a subset of Text Grab. You can run Text Grab by itself without PowerToys. The API used by both is this one: https://learn.microsoft.com/en-us/uwp/api/windows.media.ocr?view=winrt-26100

zydjohnHotmail commented 4 days ago

Hi, Thank you very much for your quick reply. I will take a look, but I have one concern, due to other requirements, currently I can only use WinForms project to run the Text Extractor in PowerToy, but the url you provided seem I have to use UWP, which is not WinForms project, I don't know if I can use this for my WinForms project. Please advise on this issue. Thanks,

TheJoeFin commented 4 days ago

https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/desktop-to-uwp-enhance