Share your Scripts #64
albertalef
started this conversation in
Show and tell
Replies: 1 comment
-
|
Script to copy the text of a part of the screen (Using OCR). #!/usr/bin/env ruby
# frozen_string_literal: true
require "rubyshell"
sh do
# Use Slurp to select on screen, and use grim to print the screen in selected area
image = grim("-g", slurp.quoted, "-")
# OCR the image
content = tesseract(
"- stdout",
c: [
"load_system_dawg=1",
"load_freq_dawg=1",
'tessedit_char_blacklist="¦"'
],
oem: 1,
psm: 6,
_stdin: image
)
# Put text on clipboard
sh("wl-copy", _stdin: content)
# Send notification
sh(
"notify-send",
"-h string:x-canonical-private-synchronous:ocr",
"-h string:markup-body:1",
'"OCR copiado"',
content.quoted
)
end
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Thread used to share useful scripts
Beta Was this translation helpful? Give feedback.
All reactions