Text-Grab icon indicating copy to clipboard operation
Text-Grab copied to clipboard

Automatic actions on OCR'd filepaths or urls

Open CopaceticMeatbag opened this issue 2 years ago • 1 comments

Allow system default handler to auto action recognised filepaths or URLs I've stumbled across this project looking for a solution to allow our MSTeams users to quickly and easily open network links in MSTeams (which only allows http or sharepoint links), but I can think of a myriad of cases where this will be useful. Basically after the OCR is done, we could check each line to see if it conforms to a specific format (e.g. maybe [A-Z]:.* to match network drive filepaths) then pass it off to explorer.exe to open with it's default handler. This would mean I can take a quick grab of a link pasted in Teams and have it open automatically, saving the user from manually selecting, copying, going to the appropriate program and pasting.

Potential suggested solution? Example for FullscreenGrab.xaml.cs, after line 214 textFromOCR = grabbedText;

if (File.Exists(textFromOCR) || (Uri.TryCreate(textFromOCR, UriKind.Absolute, out Uri uriResult) && (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps)))
            System.Diagnostics.Process.Start(textFromOCR);

Mode which would include change

  • [ ] Full-screen Grab
  • [ ] Grab Frame
  • [ ] Settings Window

Thanks very much for this excellent program, I wish I'd found this a lot sooner 😅 finally I can ditch my dodgy AHK scripts!

CopaceticMeatbag avatar Feb 28 '23 04:02 CopaceticMeatbag

I like this idea! Right now the Edit Text Window and The Quick Simple Lookup both have the ability to auto launch URLs so this would be a natural extension of that feature into the other modes.

One challenge would be that URLs/URIs tend to be very precise and one incorrectly read character could make the link incorrect. However that is just the nature of OCR, I'll consider how to make that experience as good as possible.

TheJoeFin avatar Mar 01 '23 17:03 TheJoeFin