Code Monkey home page Code Monkey logo

text-grab's Introduction

Text Grab

Copy any text you can see.

Store link

Overview

All Modes In Light Mode

This is a minimal optical character recognition (OCR) utility for Windows 10/11 which makes all visible text available to be copied.

Too often text is trapped within images, videos, or within parts of applications and cannot be selected. Text Grab takes a screenshot, passes that image to the OCR engine, then puts the text into the clipboard for use anywhere. The OCR is done locally by Windows API. This enables Text Grab to have essentially no UI and not require a constantly running background process. Working with text can be much more than just copying text from images, so Text Grab has a range of different modes to make working with text fast and easy.

I am the author of the PowerToy Text Extractor. The Full-Screen Grab mode of this app was the basis of that PowerToy

How to Install

Official

Community

  • scoopscoop install text-grab
  • choco - choco install text-grab

How to Build

Get the code:

With Visual Studio 2019 or 2022

  • Install the Visual Studio (the free community edition is sufficient).
    • Install the "Universal Windows Platform Development" workload.
    • Install the ".NET desktop development" workload.
    • Install ".NET cross-platform development" toolset
    • Install Windows 10 SDK (10.0.19041.0)
  • Open \Text-Grab\Text-Grab.sln in Visual Studio.
  • Set Text-Grab-Package as Startup Project
  • Set CPU Target to x86 or x64
  • Key F5 or Press "▶ Local Machine"

With Visual Studio Code (VS Code)

Text Grab has Four Modes

1. Full-Screen Mode (basis of Text Extractor)

Select text from a region

The first full screen use case is the most obvious, selecting a region of the screen and the text within the selected region will be added to the clipboard.

The second use case takes a single click and attempts to copy the word which was clicked on. This is enabled because the Windows 10 OCR API draws a bounding box around each recognized word.

If the click point or selected region has no text in it the Text Grab window stays active. To exit the application, press the escape key, right-click and choose cancel, or Alt+F4.

2. Grab Frame Mode

Grab Frame

Grab frame is mostly a transparent frame with a search bar and Grab button. The Grab Frame can be positioned wherever you want to copy the text. This can be done by searching for text, clicking on a word border, and/or clicking on the Grab button.

The underlying OCR technology is the same as the full screen mode and has all of the same benefits and drawbacks. Since Text Grab is using OCR the recognition is not perfect. However, adjusting the size and position of the window does affect the OCR's accuracy.

3. Edit Text Window

Similar to Notepad, the Edit Text Window is a "Pure Text" editing experience, with no formatting. This means copying text into or out of the Window will remove all formatting, but linebreaks and tabs will remain. Gather text using Full Screen Grabs or Grab Frames.

There are several tools with in the Edit Text Window which make it quick and easy to fix or change text.

  • List files and folders in chosen directory
  • Watch clipboard for changes
  • Make text into a single line
  • Toggle between UPPERCASE, lowercase, and Titlecase
  • Trim spaces and empty lines
  • Isolate selected text
  • Replace reserved characters (like spaces, /, %, etc.)
  • Find and replace
  • Extract regular expressions
  • Remove duplicate lines
  • Convert stacked data to table format
  • Copy text from every image in a folder
  • Launch URLs
  • And more!

4. Quick Simple Lookup

Quick Simple Lookup

This mode of Text Grab is not about OCR, but instead it is about retreiving frequently used text. Think of Quick Simple Lookup as your long term memory. Use it to store frequently used URLs, emails, part numbers, etc. Basically a custom dictionary you can edit and recall instantly at any time. The workflow for Quick Simple Lookup is designed to be fast and functional, here is how it works.

  1. Press the hotkey (Default is Win + Shift + Q)
  2. Begin typing to filter the lookup to the item you want
  3. When what you want is the first result, press enter
  4. Then paste the value you just copied into the application you are using

Bonus. Command Line Interface

Arguments

  • Fullscreen launches into Fullscreen Grab mode
  • GrabFrame launches a new Grab Frame
  • EditText launches a new Edit Text Window
  • "Settings` opens Text Grab settings
  • "file path" Text Grab will open the file if it is a Text file, but if it is an image file it will OCR the file and place the results into a new Edit Text Window.
  • "folder path" e.g. .\Text-Grab.exe "C:\Users\myPC\Downloads" Text Grab will launch a new Edit Text Window and scan all images in that directory.

Principles

Text Grab is designed to have multiple modes, from minimal to fully featured; all focused on productivity. By using Windows 10’s OCR capabilities Text Grab can launch quickly without needing to run in the background. Pinning Text Grab to the Taskbar enables launching via keyboard shortcut. Now with version 2.4 when the background process is enabled Text Grab can be activated from anywhere using global hotkeys. The full-screen mode is designed to be used hundreds of times a day. Reducing clicks and menus means saving time, which is the primary focus of Text Grab. The Grab Frame tool can be positioned on top of any text content for quick OCR any time. When it comes to manipulating the text you've copied the Edit Text Window offers a wide range of tools to speed up common tasks and take the raw text into clean usable content.

Packages Used

Thanks for using Text Grab

Hopefully this simple app makes you more productive and saves you time from transcribing text. If you have any questions or feedback reach out on Twitter @TheJoeFin or by email [email protected]

Pssst, on a Mac?

Check out the awesome app Text Sniper! It is very similar to Text Grab but for Mac! And if you use my affiliate link here you will support Text Grab development as well!

text-grab's People

Contributors

antonycorbett avatar dependabot[bot] avatar djrhodes avatar gexgd0419 avatar hmnd avatar imgbotapp avatar rajdave69 avatar thejoefin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

text-grab's Issues

Add option to not copy to clipboard

There should be an option to not copy to clipboard, if the "Show Toast" setting is enabled. It feels redundant to get a notification and have the text be copied to clipboard.

Table mode

A more involved mode which quickly draws a table on the screen for a more seamless paste into Excel.

First Run Dialog

There should be some sort of dialog which pops up to explain how Text Grab works on first run

Customizable bottom bar

Have the ability to add or remove buttons from the bottom bar. Also make buttons icons or full buttons.

Assign keyboard shortcuts to open TextGrab

You would do ctrl + shift + any key to open text edit, and maybe other shortcuts for fullscreen or grab frame, but if that's too much work, the shortcut would open the default one you chose in settings.

Suppport windows 10 other languages

The application hangs when running on windows 10 with other language than English (I suppose but at least using french).
Can be specific of english version with MUI.

Here is the .NET Runtime error reported in log :
Application: Text-Grab.exe
CoreCLR Version: 4.700.20.47201
.NET Core Version: 3.1.9
Description: The process was terminated due to an unhandled exception.
Exception Info: System.MissingMethodException: Method not found: 'System.String Windows.Globalization.Language.get_AbbreviatedName()'.
at Text_Grab.MainWindow.<>c__DisplayClass14_0.b__1(Language la)
at System.Linq.Enumerable.WhereListIterator1.ToList() at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)
at Text_Grab.MainWindow.ExtractText(Bitmap bmp, String languageCode, Nullable`1 singlePoint)
at Text_Grab.MainWindow.GetRegionsText(Rectangle selectedRegion)
at Text_Grab.MainWindow.RegionClickCanvas_MouseUp(Object sender, MouseButtonEventArgs e)
at System.Threading.Tasks.Task.<>c.b__139_0(Object state)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run()
at Text_Grab.App.Main()

Here is the Application Error :
Nom de l’application défaillante Text-Grab.exe, version : 0.0.0.0, horodatage : 0x5f6b3846
Nom du module défaillant : KERNELBASE.dll, version : 10.0.17763.1790, horodatage : 0x16e07148
Code d’exception : 0xe0434352
Décalage d’erreur : 0x001226c2
ID du processus défaillant : 0x41f8
Heure de début de l’application défaillante : 0x01d73214e3607b4a
Chemin d’accès de l’application défaillante : C:\Program Files\WindowsApps\40087JoeFinApps.TextGrab_1.5.0.0_x86__kdbpvth5scec4\Text-Grab\Text-Grab.exe
Chemin d’accès du module défaillant: C:\WINDOWS\System32\KERNELBASE.dll
ID de rapport : 489e2446-6ba1-44da-8f6b-fa05418c7c7e
Nom complet du package défaillant : 40087JoeFinApps.TextGrab_1.5.0.0_x86__kdbpvth5scec4
ID de l’application relative au package défaillant : App

Switching windows 10 to English make it works.
Available for translation of the error above if needed.

Suggestion: Add option for a ShortCut key

Would love to be able to call up the app in "grab" mode using a keyboard shortcut, much in the way that Win+Shift+S opens up the graphics screen clip. Ideal if this could be switched on/off, custom selected and maybe having a default key such as Win+Ctrl+S (which seems to be unused by Windows and things like PowerToys).

Extract Simple Text Pattern

Extract the most simple Regex Pattern from a selected string.

Char.IsLetter -> \w
Char.IsDigit -> \d
Char.IsWhitespace -> \s
Else, use exact match

ABC123 -> ( \w{3}\d{3})
ABC-123 -> (\w{3}-\d{3})

Chinese/Multilingual Support

Is there a desire to have support for multiple languages? It appears that the API that you are using supports that: https://docs.microsoft.com/en-us/uwp/api/windows.media.ocr.ocrengine?view=winrt-19041#properties

I see that you are just using the language returned by InstalledLanguages.FirstOrDefault(). If you are interested in multi-lingual support, do you have any ideas of how you'd like to see that support added? I might be able to contribute a PR. Initially, the thing that comes to mind is using the current keyboard setting as the language.

Some characters are recognised incorrectly or not at all

Example picture:
image

Extracted text:

Das Kennwort muss 8-64 Zeichen lang seim
Folgende Zeichen sind zulässig: a-z, A-ZI 0-9,
-+='l 0 0; und Platz.

as you can see, an "n." becomes an "m" and a "Z," becomes a "ZI".
special letters are missing completely

UI localization

Do you have any plans on localizing the UI after #3 is done?
I'd suggest using some online platform like crowdin.com (free) so the community could help easily (without them having to install Visual Studio and you handling pull requests for translation updates).

I'd also like to offer my help translating from English to Czech (cs-CZ) if needed.

Thanks for this great tool.

Persistent frame mode

Text Grab could open a persistent frame which can be positioned around the screen and has a capture button. When pressing the capture button the frame does not go away, but text is grabbed and added to clipboard.
Maybe the frame could do more interesting things like display bounding boxes around recognized words.

Copies Cyrillic text with english/latin characters

Previous versions of the app worked fine, but now I can't copy cyrillic texts.

For example, it copies this text:

ЭТО ТЕСТОВЫЙ ТЕКСТ ДЛЯ КОПИРОВАНИЯ В ПРОГРАММУ

as this one:

310 TECTOBblVl TEKCT AJIR KOIUlPOBAHV19 B nporPAMMY

Windows 10 20H2, all the locales are RU-ru and the keyboard first language is russian.
TextGrab ver: 1.4.0.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.