PowerToys icon indicating copy to clipboard operation
PowerToys copied to clipboard

[WIP] [New PowerToy] Create new OCR PowerToy

Open TheJoeFin opened this issue 2 years ago • 33 comments

Summary of the Pull Request

This PR introduces a new PowerToy to perform OCR anywhere on screen by selecting a rectangular region, clicking a word, or right-clicking an image file and selecting PowerOCR.

As of the first week in July, there is much more that needs to be done to make this PowerToy ready for prime time, but this is the MVP if anyone wanted to pull and build just this tool. Most of the code is copied from my repository Text Grab.

PR Checklist

  • [ ] Closes: #4371
  • [x] Communication: I have discussed this PowerToy with @crutkas
  • [ ] Tests: Added/updated and all pass
  • [ ] Localization: All end user facing strings can be localized
  • [ ] Dev docs: Added/updated
  • [ ] New binaries: Added on the required places
  • [ ] Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

  • Currently this project is just the MVP of a region selection on a single screen. There is much more work needed before this PR is ready to merge
    • [x] Work on multi-monitor
    • [ ] Capture cursor to keep within each monitor
    • [ ] Add Right-click image option
    • [ ] Add Tests
    • [ ] Connect to the installer
    • [ ] Add settings page
  • This app is very simple and built in a very straightforward way. Possible considerations
    • Change over to MVVM
    • Possibly extract some of the bitmap manipulation methods into PowerToys Utils
    • Add options at top like Snipping Tool
    • I can do some more experimental work on the Windows OCR API to find the ideal text line height

Validation Steps Performed

  • Tested by building and manually testing

TheJoeFin avatar Jul 05 '22 02:07 TheJoeFin

CLA assistant check
All CLA requirements met.

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view or the :scroll:action log for details.

Unrecognized words (10)

CLIPBOARDUPDATE Langs multimon ocr overriden PArgb retured tbmp toogle windowsapp

Previously acknowledged words that are now absent binaryformatter gsuberland ICONWARNING IStorage IWork messageboxes OSVERSIONINFOW PRTL REMOTEDISPLAY REMOTESESSION serializationexception SYSLIB upto Windowsapp
To accept :heavy_check_mark: these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands

... in a clone of the [email protected]:TheJoeFin/PowerToys.git repository on the main branch (:information_source: how do I use this?):

update_files() {
perl -e '
my @expect_files=qw('".github/actions/spell-check/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spell-check/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
}

comment_json=$(mktemp)
curl -L -s -S \
-H "Content-Type: application/json" \
"https://api.github.com/repos/microsoft/PowerToys/issues/comments/1174547207" > "$comment_json"
comment_body=$(mktemp)
jq -r ".body // empty" "$comment_json" | tr -d "\\r" > $comment_body
rm $comment_json

patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")

patch_add=$(perl -e '$/=undef; $_=<>; if (m{Unrecognized words[^<]*</summary>\n*```\n*([^<]*)```\n*</details>$}m) { print "$1" } elsif (m{Unrecognized words[^<]*\n\n((?:\w.*\n)+)\n}m) { print "$1" };' < "$comment_body")

update_files
rm $comment_body
git add -u

Warnings (1)

See the :open_file_folder: files view or the :scroll:action log for details.

:information_source: Warnings Count
:information_source: limited-references 3

See :information_source: Event descriptions for more information.

If the flagged items do not appear to be text

If items relate to a ...

  • well-formed pattern.

    If you can write a pattern that would match it, try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

  • binary file.

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

github-actions[bot] avatar Jul 05 '22 02:07 github-actions[bot]

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view or the :scroll:action log for details.

Unrecognized words (10)

CLIPBOARDUPDATE Langs multimon ocr overriden PArgb retured tbmp toogle windowsapp

Previously acknowledged words that are now absent binaryformatter gsuberland ICONWARNING IStorage IWork messageboxes OSVERSIONINFOW PRTL REMOTEDISPLAY REMOTESESSION serializationexception SYSLIB upto Windowsapp
To accept :heavy_check_mark: these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands

... in a clone of the [email protected]:TheJoeFin/PowerToys.git repository on the main branch (:information_source: how do I use this?):

update_files() {
perl -e '
my @expect_files=qw('".github/actions/spell-check/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spell-check/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
}

comment_json=$(mktemp)
curl -L -s -S \
-H "Content-Type: application/json" \
"https://api.github.com/repos/microsoft/PowerToys/issues/comments/1174551168" > "$comment_json"
comment_body=$(mktemp)
jq -r ".body // empty" "$comment_json" | tr -d "\\r" > $comment_body
rm $comment_json

patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")

patch_add=$(perl -e '$/=undef; $_=<>; if (m{Unrecognized words[^<]*</summary>\n*```\n*([^<]*)```\n*</details>$}m) { print "$1" } elsif (m{Unrecognized words[^<]*\n\n((?:\w.*\n)+)\n}m) { print "$1" };' < "$comment_body")

update_files
rm $comment_body
git add -u

Warnings (1)

See the :open_file_folder: files view or the :scroll:action log for details.

:information_source: Warnings Count
:information_source: limited-references 3

See :information_source: Event descriptions for more information.

If the flagged items do not appear to be text

If items relate to a ...

  • well-formed pattern.

    If you can write a pattern that would match it, try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

  • binary file.

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

github-actions[bot] avatar Jul 05 '22 03:07 github-actions[bot]

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view or the :scroll:action log for details.

Unrecognized words (8)

CLIPBOARDUPDATE Langs ocr overriden PArgb retured toogle windowsapp

Previously acknowledged words that are now absent binaryformatter gsuberland ICONWARNING IStorage IWork messageboxes OSVERSIONINFOW PRTL REMOTEDISPLAY REMOTESESSION serializationexception SYSLIB upto Windowsapp
To accept :heavy_check_mark: these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands

... in a clone of the [email protected]:TheJoeFin/PowerToys.git repository on the main branch (:information_source: how do I use this?):

update_files() {
perl -e '
my @expect_files=qw('".github/actions/spell-check/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spell-check/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
}

comment_json=$(mktemp)
curl -L -s -S \
-H "Content-Type: application/json" \
"https://api.github.com/repos/microsoft/PowerToys/issues/comments/1175615918" > "$comment_json"
comment_body=$(mktemp)
jq -r ".body // empty" "$comment_json" | tr -d "\\r" > $comment_body
rm $comment_json

patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")

patch_add=$(perl -e '$/=undef; $_=<>; if (m{Unrecognized words[^<]*</summary>\n*```\n*([^<]*)```\n*</details>$}m) { print "$1" } elsif (m{Unrecognized words[^<]*\n\n((?:\w.*\n)+)\n}m) { print "$1" };' < "$comment_body")

update_files
rm $comment_body
git add -u

Warnings (1)

See the :open_file_folder: files view or the :scroll:action log for details.

:information_source: Warnings Count
:information_source: limited-references 2

See :information_source: Event descriptions for more information.

If the flagged items do not appear to be text

If items relate to a ...

  • well-formed pattern.

    If you can write a pattern that would match it, try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

  • binary file.

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

github-actions[bot] avatar Jul 06 '22 00:07 github-actions[bot]

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view or the :scroll:action log for details.

Unrecognized words (7)

Langs ocr overriden PArgb retured toogle windowsapp

Previously acknowledged words that are now absent binaryformatter gsuberland ICONWARNING IStorage IWork messageboxes OSVERSIONINFOW PRTL REMOTEDISPLAY REMOTESESSION serializationexception SYSLIB upto Windowsapp
To accept :heavy_check_mark: these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands

... in a clone of the [email protected]:TheJoeFin/PowerToys.git repository on the main branch (:information_source: how do I use this?):

update_files() {
perl -e '
my @expect_files=qw('".github/actions/spell-check/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spell-check/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
}

comment_json=$(mktemp)
curl -L -s -S \
-H "Content-Type: application/json" \
"https://api.github.com/repos/microsoft/PowerToys/issues/comments/1175631558" > "$comment_json"
comment_body=$(mktemp)
jq -r ".body // empty" "$comment_json" | tr -d "\\r" > $comment_body
rm $comment_json

patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")

patch_add=$(perl -e '$/=undef; $_=<>; if (m{Unrecognized words[^<]*</summary>\n*```\n*([^<]*)```\n*</details>$}m) { print "$1" } elsif (m{Unrecognized words[^<]*\n\n((?:\w.*\n)+)\n}m) { print "$1" };' < "$comment_body")

update_files
rm $comment_body
git add -u

Warnings (1)

See the :open_file_folder: files view or the :scroll:action log for details.

:information_source: Warnings Count
:information_source: limited-references 2

See :information_source: Event descriptions for more information.

If the flagged items do not appear to be text

If items relate to a ...

  • well-formed pattern.

    If you can write a pattern that would match it, try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

  • binary file.

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

github-actions[bot] avatar Jul 06 '22 00:07 github-actions[bot]

What do you mean with mvp. Do you mean this PR is WIP?

Aaron-Junker avatar Jul 06 '22 05:07 Aaron-Junker

@Aaron-Junker by MVP I meant that the region selection OCR fully works just that it is a Minimally Viable Product as it stands currently. If anyone wants to pull my branch and build, it will work for them. I will edit the original comment to be more clear.

This is still a WIP and I will be working to get it where it needs to be for full inclusion into PowerToys.

TheJoeFin avatar Jul 06 '22 15:07 TheJoeFin

@Aaron-Junker by MVP I meant that the region selection OCR fully works just that it is a Minimally Viable Product as it stands currently. If anyone wants to pull my branch and build, it will work for them. I will edit the original comment to be more clear.

This is still a WIP and I will be working to get it where it needs to be for full inclusion into PowerToys.

Oh. Thank you for the explanation. I thought maybe you mixed it up.

Aaron-Junker avatar Jul 06 '22 15:07 Aaron-Junker

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view or the :scroll:action log for details.

Unrecognized words (7)

Langs ocr overriden PArgb retured toogle windowsapp

Previously acknowledged words that are now absent binaryformatter gsuberland ICONWARNING IStorage IWork messageboxes OSVERSIONINFOW PRTL REMOTEDISPLAY REMOTESESSION serializationexception SYSLIB upto Windowsapp
To accept :heavy_check_mark: these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands

... in a clone of the [email protected]:TheJoeFin/PowerToys.git repository on the main branch (:information_source: how do I use this?):

update_files() {
perl -e '
my @expect_files=qw('".github/actions/spell-check/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spell-check/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
}

comment_json=$(mktemp)
curl -L -s -S \
-H "Content-Type: application/json" \
"https://api.github.com/repos/microsoft/PowerToys/issues/comments/1179574734" > "$comment_json"
comment_body=$(mktemp)
jq -r ".body // empty" "$comment_json" | tr -d "\\r" > $comment_body
rm $comment_json

patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")

patch_add=$(perl -e '$/=undef; $_=<>; if (m{Unrecognized words[^<]*</summary>\n*```\n*([^<]*)```\n*</details>$}m) { print "$1" } elsif (m{Unrecognized words[^<]*\n\n((?:\w.*\n)+)\n}m) { print "$1" };' < "$comment_body")

update_files
rm $comment_body
git add -u

Warnings (1)

See the :open_file_folder: files view or the :scroll:action log for details.

:information_source: Warnings Count
:information_source: limited-references 2

See :information_source: Event descriptions for more information.

If the flagged items do not appear to be text

If items relate to a ...

  • well-formed pattern.

    If you can write a pattern that would match it, try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

  • binary file.

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

github-actions[bot] avatar Jul 09 '22 17:07 github-actions[bot]

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view or the :scroll:action log for details.

Unrecognized words (8)

fsg Langs ocr overriden PArgb retured toogle windowsapp

Previously acknowledged words that are now absent binaryformatter gsuberland ICONWARNING IStorage IWork messageboxes OSVERSIONINFOW PRTL REMOTEDISPLAY REMOTESESSION serializationexception SYSLIB upto Windowsapp
To accept :heavy_check_mark: these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands

... in a clone of the [email protected]:TheJoeFin/PowerToys.git repository on the main branch (:information_source: how do I use this?):

update_files() {
perl -e '
my @expect_files=qw('".github/actions/spell-check/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spell-check/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
}

comment_json=$(mktemp)
curl -L -s -S \
-H "Content-Type: application/json" \
"https://api.github.com/repos/microsoft/PowerToys/issues/comments/1179630129" > "$comment_json"
comment_body=$(mktemp)
jq -r ".body // empty" "$comment_json" | tr -d "\\r" > $comment_body
rm $comment_json

patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")

patch_add=$(perl -e '$/=undef; $_=<>; if (m{Unrecognized words[^<]*</summary>\n*```\n*([^<]*)```\n*</details>$}m) { print "$1" } elsif (m{Unrecognized words[^<]*\n\n((?:\w.*\n)+)\n}m) { print "$1" };' < "$comment_body")

update_files
rm $comment_body
git add -u

Warnings (1)

See the :open_file_folder: files view or the :scroll:action log for details.

:information_source: Warnings Count
:information_source: limited-references 2

See :information_source: Event descriptions for more information.

If the flagged items do not appear to be text

If items relate to a ...

  • well-formed pattern.

    If you can write a pattern that would match it, try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

  • binary file.

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

github-actions[bot] avatar Jul 10 '22 00:07 github-actions[bot]

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view or the :scroll:action log for details.

Unrecognized words (7)

Langs ocr overriden PArgb retured toogle windowsapp

Previously acknowledged words that are now absent binaryformatter gsuberland ICONWARNING IStorage IWork messageboxes OSVERSIONINFOW PRTL REMOTEDISPLAY REMOTESESSION serializationexception SYSLIB upto Windowsapp
To accept :heavy_check_mark: these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands

... in a clone of the [email protected]:TheJoeFin/PowerToys.git repository on the main branch (:information_source: how do I use this?):

update_files() {
perl -e '
my @expect_files=qw('".github/actions/spell-check/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spell-check/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
}

comment_json=$(mktemp)
curl -L -s -S \
-H "Content-Type: application/json" \
"https://api.github.com/repos/microsoft/PowerToys/issues/comments/1179630825" > "$comment_json"
comment_body=$(mktemp)
jq -r ".body // empty" "$comment_json" | tr -d "\\r" > $comment_body
rm $comment_json

patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")

patch_add=$(perl -e '$/=undef; $_=<>; if (m{Unrecognized words[^<]*</summary>\n*```\n*([^<]*)```\n*</details>$}m) { print "$1" } elsif (m{Unrecognized words[^<]*\n\n((?:\w.*\n)+)\n}m) { print "$1" };' < "$comment_body")

update_files
rm $comment_body
git add -u

Warnings (1)

See the :open_file_folder: files view or the :scroll:action log for details.

:information_source: Warnings Count
:information_source: limited-references 2

See :information_source: Event descriptions for more information.

If the flagged items do not appear to be text

If items relate to a ...

  • well-formed pattern.

    If you can write a pattern that would match it, try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

  • binary file.

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

github-actions[bot] avatar Jul 10 '22 00:07 github-actions[bot]

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view or the :scroll:action log for details.

Unrecognized words (7)

Langs ocr overriden PArgb retured toogle windowsapp

Previously acknowledged words that are now absent binaryformatter gsuberland ICONWARNING IStorage IWork messageboxes OSVERSIONINFOW PRTL REMOTEDISPLAY REMOTESESSION serializationexception SYSLIB upto Windowsapp
To accept :heavy_check_mark: these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands

... in a clone of the [email protected]:TheJoeFin/PowerToys.git repository on the main branch (:information_source: how do I use this?):

update_files() {
perl -e '
my @expect_files=qw('".github/actions/spell-check/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spell-check/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
}

comment_json=$(mktemp)
curl -L -s -S \
-H "Content-Type: application/json" \
"https://api.github.com/repos/microsoft/PowerToys/issues/comments/1179646594" > "$comment_json"
comment_body=$(mktemp)
jq -r ".body // empty" "$comment_json" | tr -d "\\r" > $comment_body
rm $comment_json

patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")

patch_add=$(perl -e '$/=undef; $_=<>; if (m{Unrecognized words[^<]*</summary>\n*```\n*([^<]*)```\n*</details>$}m) { print "$1" } elsif (m{Unrecognized words[^<]*\n\n((?:\w.*\n)+)\n}m) { print "$1" };' < "$comment_body")

update_files
rm $comment_body
git add -u

Warnings (1)

See the :open_file_folder: files view or the :scroll:action log for details.

:information_source: Warnings Count
:information_source: limited-references 2

See :information_source: Event descriptions for more information.

If the flagged items do not appear to be text

If items relate to a ...

  • well-formed pattern.

    If you can write a pattern that would match it, try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

  • binary file.

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

github-actions[bot] avatar Jul 10 '22 03:07 github-actions[bot]

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view or the :scroll:action log for details.

Unrecognized words (7)

Langs ocr overriden PArgb retured toogle windowsapp

Previously acknowledged words that are now absent binaryformatter gsuberland ICONWARNING IStorage IWork messageboxes OSVERSIONINFOW PRTL REMOTEDISPLAY REMOTESESSION serializationexception SYSLIB upto Windowsapp
To accept :heavy_check_mark: these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands

... in a clone of the [email protected]:TheJoeFin/PowerToys.git repository on the main branch (:information_source: how do I use this?):

update_files() {
perl -e '
my @expect_files=qw('".github/actions/spell-check/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spell-check/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
}

comment_json=$(mktemp)
curl -L -s -S \
-H "Content-Type: application/json" \
"https://api.github.com/repos/microsoft/PowerToys/issues/comments/1179745189" > "$comment_json"
comment_body=$(mktemp)
jq -r ".body // empty" "$comment_json" | tr -d "\\r" > $comment_body
rm $comment_json

patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")

patch_add=$(perl -e '$/=undef; $_=<>; if (m{Unrecognized words[^<]*</summary>\n*```\n*([^<]*)```\n*</details>$}m) { print "$1" } elsif (m{Unrecognized words[^<]*\n\n((?:\w.*\n)+)\n}m) { print "$1" };' < "$comment_body")

update_files
rm $comment_body
git add -u

Warnings (1)

See the :open_file_folder: files view or the :scroll:action log for details.

:information_source: Warnings Count
:information_source: limited-references 2

See :information_source: Event descriptions for more information.

If the flagged items do not appear to be text

If items relate to a ...

  • well-formed pattern.

    If you can write a pattern that would match it, try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

  • binary file.

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

github-actions[bot] avatar Jul 10 '22 15:07 github-actions[bot]

@TheJoeFin give me a heads up when you want someone to review / give it a spin.

crutkas avatar Jul 11 '22 20:07 crutkas

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view or the :scroll:action log for details.

Unrecognized words (7)

Langs ocr overriden PArgb retured toogle windowsapp

Previously acknowledged words that are now absent binaryformatter gsuberland ICONWARNING IStorage IWork messageboxes OSVERSIONINFOW PRTL REMOTEDISPLAY REMOTESESSION serializationexception SYSLIB upto Windowsapp
Some files were automatically ignored

These sample patterns would exclude them:

^\Qsrc/modules/PowerOCR/PowerOCRModuleInterface/dllmain.h\E$

You should consider adding them to:

.github/actions/spell-check/excludes.txt

File matching is via Perl regular expressions.

To check these files, more of their words need to be in the dictionary than not. You can use patterns.txt to exclude portions, add items to the dictionary (e.g. by adding them to allow.txt), or fix typos.

To accept :heavy_check_mark: these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands

... in a clone of the [email protected]:TheJoeFin/PowerToys.git repository on the main branch (:information_source: how do I use this?):

update_files() {
perl -e '
my @expect_files=qw('".github/actions/spell-check/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spell-check/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
(cat '.github/actions/spell-check/excludes.txt' - 2> /dev/null <<EOF
^\Qsrc/modules/PowerOCR/PowerOCRModuleInterface/dllmain.h\E$
EOF
) |grep .|
sort -f |
uniq > '.github/actions/spell-check/excludes.txt.temp' &&
mv '.github/actions/spell-check/excludes.txt.temp' '.github/actions/spell-check/excludes.txt'
}

comment_json=$(mktemp)
curl -L -s -S \
-H "Content-Type: application/json" \
"https://api.github.com/repos/microsoft/PowerToys/issues/comments/1181281872" > "$comment_json"
comment_body=$(mktemp)
jq -r ".body // empty" "$comment_json" | tr -d "\\r" > $comment_body
rm $comment_json

patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")

patch_add=$(perl -e '$/=undef; $_=<>; if (m{Unrecognized words[^<]*</summary>\n*```\n*([^<]*)```\n*</details>$}m) { print "$1" } elsif (m{Unrecognized words[^<]*\n\n((?:\w.*\n)+)\n}m) { print "$1" };' < "$comment_body")

update_files
rm $comment_body
git add -u

Warnings (2)

See the :open_file_folder: files view or the :scroll:action log for details.

:information_source: Warnings Count
:information_source: limited-references 2
:information_source: noisy-file 1

See :information_source: Event descriptions for more information.

If the flagged items do not appear to be text

If items relate to a ...

  • well-formed pattern.

    If you can write a pattern that would match it, try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

  • binary file.

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

github-actions[bot] avatar Jul 12 '22 03:07 github-actions[bot]

@crutkas I am working on getting the settings hooked up and the C++ module interface project to work properly (but I've never done anything like that so kind of tricky).

The PowerOCR app does work on its own though, so if someone wants to take a look at that they could.

TheJoeFin avatar Jul 12 '22 03:07 TheJoeFin

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view or the :scroll:action log for details.

Unrecognized words (7)

Langs ocr overriden PArgb retured toogle windowsapp

Previously acknowledged words that are now absent binaryformatter gsuberland ICONWARNING IStorage IWork messageboxes OSVERSIONINFOW PRTL REMOTEDISPLAY REMOTESESSION serializationexception SYSLIB upto Windowsapp
Some files were automatically ignored

These sample patterns would exclude them:

^\Qsrc/modules/PowerOCR/PowerOCRModuleInterface/dllmain.h\E$

You should consider adding them to:

.github/actions/spell-check/excludes.txt

File matching is via Perl regular expressions.

To check these files, more of their words need to be in the dictionary than not. You can use patterns.txt to exclude portions, add items to the dictionary (e.g. by adding them to allow.txt), or fix typos.

To accept :heavy_check_mark: these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands

... in a clone of the [email protected]:TheJoeFin/PowerToys.git repository on the main branch (:information_source: how do I use this?):

update_files() {
perl -e '
my @expect_files=qw('".github/actions/spell-check/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spell-check/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
(cat '.github/actions/spell-check/excludes.txt' - 2> /dev/null <<EOF
^\Qsrc/modules/PowerOCR/PowerOCRModuleInterface/dllmain.h\E$
EOF
) |grep .|
sort -f |
uniq > '.github/actions/spell-check/excludes.txt.temp' &&
mv '.github/actions/spell-check/excludes.txt.temp' '.github/actions/spell-check/excludes.txt'
}

comment_json=$(mktemp)
curl -L -s -S \
-H "Content-Type: application/json" \
"https://api.github.com/repos/microsoft/PowerToys/issues/comments/1182694957" > "$comment_json"
comment_body=$(mktemp)
jq -r ".body // empty" "$comment_json" | tr -d "\\r" > $comment_body
rm $comment_json

patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")

patch_add=$(perl -e '$/=undef; $_=<>; if (m{Unrecognized words[^<]*</summary>\n*```\n*([^<]*)```\n*</details>$}m) { print "$1" } elsif (m{Unrecognized words[^<]*\n\n((?:\w.*\n)+)\n}m) { print "$1" };' < "$comment_body")

update_files
rm $comment_body
git add -u

Warnings (2)

See the :open_file_folder: files view or the :scroll:action log for details.

:information_source: Warnings Count
:information_source: limited-references 2
:information_source: noisy-file 1

See :information_source: Event descriptions for more information.

If the flagged items do not appear to be text

If items relate to a ...

  • well-formed pattern.

    If you can write a pattern that would match it, try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

  • binary file.

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

github-actions[bot] avatar Jul 13 '22 02:07 github-actions[bot]

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view or the :scroll:action log for details.

Unrecognized words (4)

Langs ocr PArgb windowsapp

Previously acknowledged words that are now absent binaryformatter gsuberland ICONWARNING IStorage IWork messageboxes OSVERSIONINFOW PRTL REMOTEDISPLAY REMOTESESSION serializationexception SYSLIB upto Windowsapp
To accept :heavy_check_mark: these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands

... in a clone of the [email protected]:TheJoeFin/PowerToys.git repository on the main branch (:information_source: how do I use this?):

update_files() {
perl -e '
my @expect_files=qw('".github/actions/spell-check/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spell-check/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
}

comment_json=$(mktemp)
curl -L -s -S \
-H "Content-Type: application/json" \
"https://api.github.com/repos/microsoft/PowerToys/issues/comments/1182717072" > "$comment_json"
comment_body=$(mktemp)
jq -r ".body // empty" "$comment_json" | tr -d "\\r" > $comment_body
rm $comment_json

patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")

patch_add=$(perl -e '$/=undef; $_=<>; if (m{Unrecognized words[^<]*</summary>\n*```\n*([^<]*)```\n*</details>$}m) { print "$1" } elsif (m{Unrecognized words[^<]*\n\n((?:\w.*\n)+)\n}m) { print "$1" };' < "$comment_body")

update_files
rm $comment_body
git add -u

Warnings (1)

See the :open_file_folder: files view or the :scroll:action log for details.

:information_source: Warnings Count
:information_source: limited-references 2

See :information_source: Event descriptions for more information.

If the flagged items do not appear to be text

If items relate to a ...

  • well-formed pattern.

    If you can write a pattern that would match it, try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

  • binary file.

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

github-actions[bot] avatar Jul 13 '22 03:07 github-actions[bot]

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view or the :scroll:action log for details.

Unrecognized words (2)

ocr PArgb

Previously acknowledged words that are now absent binaryformatter gsuberland ICONWARNING IStorage IWork messageboxes OSVERSIONINFOW PRTL REMOTEDISPLAY REMOTESESSION serializationexception SYSLIB upto
To accept :heavy_check_mark: these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands

... in a clone of the [email protected]:TheJoeFin/PowerToys.git repository on the main branch (:information_source: how do I use this?):

update_files() {
perl -e '
my @expect_files=qw('".github/actions/spell-check/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spell-check/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
}

comment_json=$(mktemp)
curl -L -s -S \
-H "Content-Type: application/json" \
"https://api.github.com/repos/microsoft/PowerToys/issues/comments/1183916045" > "$comment_json"
comment_body=$(mktemp)
jq -r ".body // empty" "$comment_json" | tr -d "\\r" > $comment_body
rm $comment_json

patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")

patch_add=$(perl -e '$/=undef; $_=<>; if (m{Unrecognized words[^<]*</summary>\n*```\n*([^<]*)```\n*</details>$}m) { print "$1" } elsif (m{Unrecognized words[^<]*\n\n((?:\w.*\n)+)\n}m) { print "$1" };' < "$comment_body")

update_files
rm $comment_body
git add -u

Warnings (1)

See the :open_file_folder: files view or the :scroll:action log for details.

:information_source: Warnings Count
:information_source: limited-references 2

See :information_source: Event descriptions for more information.

If the flagged items do not appear to be text

If items relate to a ...

  • well-formed pattern.

    If you can write a pattern that would match it, try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

  • binary file.

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

github-actions[bot] avatar Jul 14 '22 02:07 github-actions[bot]

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view or the :scroll:action log for details.

Unrecognized words (2)

ocr PArgb

Previously acknowledged words that are now absent binaryformatter gsuberland ICONWARNING IStorage IWork messageboxes OSVERSIONINFOW PRTL REMOTEDISPLAY REMOTESESSION serializationexception SYSLIB upto
To accept :heavy_check_mark: these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands

... in a clone of the [email protected]:TheJoeFin/PowerToys.git repository on the main branch (:information_source: how do I use this?):

update_files() {
perl -e '
my @expect_files=qw('".github/actions/spell-check/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spell-check/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
}

comment_json=$(mktemp)
curl -L -s -S \
-H "Content-Type: application/json" \
"https://api.github.com/repos/microsoft/PowerToys/issues/comments/1183943009" > "$comment_json"
comment_body=$(mktemp)
jq -r ".body // empty" "$comment_json" | tr -d "\\r" > $comment_body
rm $comment_json

patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")

patch_add=$(perl -e '$/=undef; $_=<>; if (m{Unrecognized words[^<]*</summary>\n*```\n*([^<]*)```\n*</details>$}m) { print "$1" } elsif (m{Unrecognized words[^<]*\n\n((?:\w.*\n)+)\n}m) { print "$1" };' < "$comment_body")

update_files
rm $comment_body
git add -u

Warnings (1)

See the :open_file_folder: files view or the :scroll:action log for details.

:information_source: Warnings Count
:information_source: limited-references 2

See :information_source: Event descriptions for more information.

If the flagged items do not appear to be text

If items relate to a ...

  • well-formed pattern.

    If you can write a pattern that would match it, try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

  • binary file.

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

github-actions[bot] avatar Jul 14 '22 03:07 github-actions[bot]

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view or the :scroll:action log for details.

Unrecognized words (2)

ocr PArgb

Previously acknowledged words that are now absent binaryformatter gsuberland ICONWARNING IStorage IWork messageboxes OSVERSIONINFOW PRTL REMOTEDISPLAY REMOTESESSION serializationexception SYSLIB upto
To accept :heavy_check_mark: these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands

... in a clone of the [email protected]:TheJoeFin/PowerToys.git repository on the main branch (:information_source: how do I use this?):

update_files() {
perl -e '
my @expect_files=qw('".github/actions/spell-check/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spell-check/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
}

comment_json=$(mktemp)
curl -L -s -S \
-H "Content-Type: application/json" \
"https://api.github.com/repos/microsoft/PowerToys/issues/comments/1185130566" > "$comment_json"
comment_body=$(mktemp)
jq -r ".body // empty" "$comment_json" | tr -d "\\r" > $comment_body
rm $comment_json

patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")

patch_add=$(perl -e '$/=undef; $_=<>; if (m{Unrecognized words[^<]*</summary>\n*```\n*([^<]*)```\n*</details>$}m) { print "$1" } elsif (m{Unrecognized words[^<]*\n\n((?:\w.*\n)+)\n}m) { print "$1" };' < "$comment_body")

update_files
rm $comment_body
git add -u

Warnings (1)

See the :open_file_folder: files view or the :scroll:action log for details.

:information_source: Warnings Count
:information_source: limited-references 2

See :information_source: Event descriptions for more information.

If the flagged items do not appear to be text

If items relate to a ...

  • well-formed pattern.

    If you can write a pattern that would match it, try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

  • binary file.

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

github-actions[bot] avatar Jul 15 '22 03:07 github-actions[bot]

Hi @TheJoeFin , Please let us know when you think this is ready for review. We're also able to look into giving some help on the more PowerToys specific stuff like settings or installer if you're having issues. Awesome and huge contribution, though! Thanks a lot! ❤️

jaimecbernardo avatar Jul 15 '22 10:07 jaimecbernardo

image

Somethings wrong when trying to run it in multimonitor setup, like entire top screen is moved to bottom-right (that Edge window with this PR was fullscreen).

Also, loading PowerOCR dll fails for some reason when trying to run runner

EDIT: Let me know if any help is needed here to move this forward

stefansjfw avatar Jul 15 '22 13:07 stefansjfw

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view or the :scroll:action log for details.

Unrecognized words (2)

ocr PArgb

Previously acknowledged words that are now absent binaryformatter gsuberland ICONWARNING IStorage IWork messageboxes OSVERSIONINFOW PRTL REMOTEDISPLAY REMOTESESSION serializationexception SYSLIB upto
To accept :heavy_check_mark: these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands

... in a clone of the [email protected]:TheJoeFin/PowerToys.git repository on the main branch (:information_source: how do I use this?):

update_files() {
perl -e '
my @expect_files=qw('".github/actions/spell-check/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spell-check/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
}

comment_json=$(mktemp)
curl -L -s -S \
-H "Content-Type: application/json" \
"https://api.github.com/repos/microsoft/PowerToys/issues/comments/1185993805" > "$comment_json"
comment_body=$(mktemp)
jq -r ".body // empty" "$comment_json" | tr -d "\\r" > $comment_body
rm $comment_json

patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")

patch_add=$(perl -e '$/=undef; $_=<>; if (m{Unrecognized words[^<]*</summary>\n*```\n*([^<]*)```\n*</details>$}m) { print "$1" } elsif (m{Unrecognized words[^<]*\n\n((?:\w.*\n)+)\n}m) { print "$1" };' < "$comment_body")

update_files
rm $comment_body
git add -u

Warnings (1)

See the :open_file_folder: files view or the :scroll:action log for details.

:information_source: Warnings Count
:information_source: limited-references 2

See :information_source: Event descriptions for more information.

If the flagged items do not appear to be text

If items relate to a ...

  • well-formed pattern.

    If you can write a pattern that would match it, try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

  • binary file.

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

github-actions[bot] avatar Jul 15 '22 22:07 github-actions[bot]

@stefansjfw I found and fixed that issue. Thanks for the bug catch! I would appreciate the help getting the runner to find the module and load it properly. C++ is not a language I use, so fixing that part of the app is a challenge.

TheJoeFin avatar Jul 15 '22 22:07 TheJoeFin

@jaimecbernardo Thanks for the comment! I think the app is ready for more serious review now! The settings page is working, but still needs work and some decisions about what settings there should be.

I would be happy to do a paired programming session or just use GitHub comments.

TheJoeFin avatar Jul 15 '22 22:07 TheJoeFin

@stefansjfw I found and fixed that issue. Thanks for the bug catch! I would appreciate the help getting the runner to find the module and load it properly. C++ is not a language I use, so fixing that part of the app is a challenge.

looking into it..

stefansjfw avatar Jul 18 '22 09:07 stefansjfw

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view or the :scroll:action log for details.

Unrecognized words (2)

ocr PArgb

Previously acknowledged words that are now absent binaryformatter gsuberland ICONWARNING IStorage IWork messageboxes OSVERSIONINFOW PRTL REMOTEDISPLAY REMOTESESSION serializationexception SYSLIB upto
To accept :heavy_check_mark: these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands

... in a clone of the [email protected]:TheJoeFin/PowerToys.git repository on the main branch (:information_source: how do I use this?):

update_files() {
perl -e '
my @expect_files=qw('".github/actions/spell-check/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spell-check/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
}

comment_json=$(mktemp)
curl -L -s -S \
-H "Content-Type: application/json" \
"https://api.github.com/repos/microsoft/PowerToys/issues/comments/1188397676" > "$comment_json"
comment_body=$(mktemp)
jq -r ".body // empty" "$comment_json" | tr -d "\\r" > $comment_body
rm $comment_json

patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")

patch_add=$(perl -e '$/=undef; $_=<>; if (m{Unrecognized words[^<]*</summary>\n*```\n*([^<]*)```\n*</details>$}m) { print "$1" } elsif (m{Unrecognized words[^<]*\n\n((?:\w.*\n)+)\n}m) { print "$1" };' < "$comment_body")

update_files
rm $comment_body
git add -u

Warnings (1)

See the :open_file_folder: files view or the :scroll:action log for details.

:information_source: Warnings Count
:information_source: limited-references 2

See :information_source: Event descriptions for more information.

If the flagged items do not appear to be text

If items relate to a ...

  • well-formed pattern.

    If you can write a pattern that would match it, try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

  • binary file.

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

github-actions[bot] avatar Jul 18 '22 22:07 github-actions[bot]

I went in and added in the spell check items

crutkas avatar Jul 18 '22 22:07 crutkas

Thanks @crutkas yesterday I was getting WSL2 working and having some issues, so I appreciate it!

TheJoeFin avatar Jul 18 '22 23:07 TheJoeFin

@crutkas I was about to add code to make PowerOCR activated with a keyboard shortcut. Is there a preferred way I should listen for a keypress within PowerToys? I will start with the way I have it working in Text Grab and update it to whatever you suggest.

edit: never mind, the way Text Grab does hotkeys does not work, I'll look to Color Picker for guidance

TheJoeFin avatar Jul 19 '22 21:07 TheJoeFin

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view or the :scroll:action log for details.

Unrecognized words (1)

POWEROCR

Previously acknowledged words that are now absent DDLM namespaceanddescendants RTCS
To accept :heavy_check_mark: these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands

... in a clone of the [email protected]:TheJoeFin/PowerToys.git repository on the main branch (:information_source: how do I use this?):

update_files() {
perl -e '
my @expect_files=qw('".github/actions/spell-check/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spell-check/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
}

comment_json=$(mktemp)
curl -L -s -S \
-H "Content-Type: application/json" \
"https://api.github.com/repos/microsoft/PowerToys/issues/comments/1205183387" > "$comment_json"
comment_body=$(mktemp)
jq -r ".body // empty" "$comment_json" | tr -d "\\r" > $comment_body
rm $comment_json

patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")

patch_add=$(perl -e '$/=undef; $_=<>; if (m{Unrecognized words[^<]*</summary>\n*```\n*([^<]*)```\n*</details>$}m) { print "$1" } elsif (m{Unrecognized words[^<]*\n\n((?:\w.*\n)+)\n}m) { print "$1" };' < "$comment_body")

update_files
rm $comment_body
git add -u

If the flagged items are false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it, try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

github-actions[bot] avatar Aug 04 '22 12:08 github-actions[bot]

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view or the :scroll:action log for details.

Unrecognized words (1)

POWEROCR

Previously acknowledged words that are now absent DDLM namespaceanddescendants RTCS
To accept :heavy_check_mark: these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands

... in a clone of the [email protected]:TheJoeFin/PowerToys.git repository on the main branch (:information_source: how do I use this?):

update_files() {
perl -e '
my @expect_files=qw('".github/actions/spell-check/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spell-check/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
}

comment_json=$(mktemp)
curl -L -s -S \
-H "Content-Type: application/json" \
"https://api.github.com/repos/microsoft/PowerToys/issues/comments/1205878137" > "$comment_json"
comment_body=$(mktemp)
jq -r ".body // empty" "$comment_json" | tr -d "\\r" > $comment_body
rm $comment_json

patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")

patch_add=$(perl -e '$/=undef; $_=<>; if (m{Unrecognized words[^<]*</summary>\n*```\n*([^<]*)```\n*</details>$}m) { print "$1" } elsif (m{Unrecognized words[^<]*\n\n((?:\w.*\n)+)\n}m) { print "$1" };' < "$comment_body")

update_files
rm $comment_body
git add -u

If the flagged items are false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it, try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

github-actions[bot] avatar Aug 04 '22 23:08 github-actions[bot]

PowerOCR is finally working as expected! Here is a gif of it working!

PowerOCR-Demo

TheJoeFin avatar Aug 16 '22 23:08 TheJoeFin

PowerOCR is finally working as expected! Here is a gif of it working!

PowerOCR-Demo

With right klick context menu too?

htcfreek avatar Aug 17 '22 00:08 htcfreek

LOVE IT!!!!

crutkas avatar Aug 17 '22 00:08 crutkas

PowerOCR is finally working as expected! Here is a gif of it working!

PowerOCR-Demo

With right klick context menu too?

No right click option yet, I was looking into how image resizer works and will do something similar.

TheJoeFin avatar Aug 17 '22 01:08 TheJoeFin

ready for review? If yes, you can un-draft it

stefansjfw avatar Aug 17 '22 08:08 stefansjfw

@stefansjfw Should we focus on just the basic PowerOCR app with this PR then put the right-click File Explorer option in a new PR?

TheJoeFin avatar Aug 17 '22 14:08 TheJoeFin

Also @niels9001 was going to add new PowerOCR icon assets.

TheJoeFin avatar Aug 17 '22 15:08 TheJoeFin

@stefansjfw Should we focus on just the basic PowerOCR app with this PR then put the right-click File Explorer option in a new PR?

Are the other things (installer, tests, cursor capture) done?

htcfreek avatar Aug 17 '22 15:08 htcfreek

Should we focus on just the basic PowerOCR app with this PR then put the right-click File Explorer option in a new PR?

Are the other things (installer, tests, cursor capture) done?

Installer is not done. Docs are not done. What tests would be required? Cursor Capture can be done very soon.

TheJoeFin avatar Aug 17 '22 15:08 TheJoeFin

Should we focus on just the basic PowerOCR app with this PR then put the right-click File Explorer option in a new PR?

Are the other things (installer, tests, cursor capture) done?

Installer is not done. Docs are not done. What tests would be required? Cursor Capture can be done very soon.

Not sure what test are required. These are the things from your list in the description.

htcfreek avatar Aug 17 '22 16:08 htcfreek

Joe, we can take care of the installer.

I could see some tests being built out as just sanity but we could push those to a future iteration and our side can pick up an oar there too.,

crutkas avatar Aug 17 '22 16:08 crutkas

How does this thing handle non-English text? or non-Latin scripts?

bzzrak avatar Aug 17 '22 18:08 bzzrak

Currently this uses the Win10 API but we have thoughts on how to do other improvements here.

crutkas avatar Aug 17 '22 18:08 crutkas

@TheJoeFin

  • I think you should add an attribution link to TextGrab on the settings page. This feature is based on your hard work.
  • Did I miss something or don't we have an oobe page yet?

@crutkas Can you create an issue to update contributing.md? Do we need some licencing notices somewhere?

@niels9001

  1. Can we add the letters OCR to the icon. Maybe in white on the dark blue rectangle. I am missing a hint to the action of marking/copying text in the current icon layout.
  2. We should have the screenshots for settings page and OOBE without showing the settings page in the background. This feels to much elements on the image. Better is to have some background image behind the image and editor.

htcfreek avatar Aug 17 '22 18:08 htcfreek

Also @niels9001 was going to add new PowerOCR icon assets.

@TheJoeFin This is awesome work 😄😄!! Feel free to get this merged in with the assets as is! I'll make sure to add the icon and any screenshots or OOBE gif in a seperate PR 😄.

@htcfreek we have an updated icon incoming 👍

niels9001 avatar Aug 17 '22 19:08 niels9001

  • Trying to open OOBE from Settings crashes Settings App
  • Changing activation shortcut in Settings doesn't work

I can do the installer part in the end. Let's fix these issues here first

These issues have been addressed.

TheJoeFin avatar Aug 19 '22 22:08 TheJoeFin

@TheJoeFin Please add the settings page here: https://github.com/microsoft/PowerToys/blob/main/src/settings-ui/Settings.UI/App.xaml.cs#L114

That is needed to open it directly from an external process.

htcfreek avatar Aug 20 '22 15:08 htcfreek

@htcfreek in reference to the two bugs you mention:

  1. Copying the menu bar of vs result in a vertical instead of horizontal word list.

This is not a bug per say but is something we should make a decision on. Currently the OCR engine takes into consideration the line breaks when combining the resulting text, but that doesn't have to be the case. For Text Grab there are some commands at the top of the screen which allow for different options to be selected when it comes to how the output text should look: Single line or multi line. Text Grab example: image

  1. If the text is a bit small simply nothing happens: no log, nor error message, no new text on the clipboard. (See example image I created.)

For this I think I will revert to the behavior of Text Grab where if there is an empty result, the OCR Overlay remains in place to make another selection.

Another thing Text Grab does when processing OCR is two passes of OCR to evaluate the current line height of the selected region and try to scale the image to an ideal line height where the OCR engine gets more reliable results. I did not add this logic into PowerOCR due to questions I had about memory usage and speed.

TheJoeFin avatar Aug 20 '22 18:08 TheJoeFin

  1. If the text is a bit small simply nothing happens: no log, nor error message, no new text on the clipboard. (See example image I created.)

For this I think I will revert to the behavior of Text Grab where if there is an empty result, the OCR Overlay remains in place to make another selection.

Another thing Text Grab does when processing OCR is two passes of OCR to evaluate the current line height of the selected region and try to scale the image to an ideal line height where the OCR engine gets more reliable results. I did not add this logic into PowerOCR due to questions I had about memory usage and speed.

I can reproduce the same on TextGrab when selecting. At least sometimes and especially when selecting the word "Herunterfahren", "Ausschalten" or "Speichern".

htcfreek avatar Aug 20 '22 18:08 htcfreek

  1. If the text is a bit small simply nothing happens: no log, nor error message, no new text on the clipboard. (See example image I created.)

For this I think I will revert to the behavior of Text Grab where if there is an empty result, the OCR Overlay remains in place to make another selection. Another thing Text Grab does when processing OCR is two passes of OCR to evaluate the current line height of the selected region and try to scale the image to an ideal line height where the OCR engine gets more reliable results. I did not add this logic into PowerOCR due to questions I had about memory usage and speed.

I can reproduce the same on TextGrab when selecting. At least sometimes and especially when selecting the word "Herunterfahren", "Ausschalten" or "Speichern".

OCR sometimes does fail to get a result, but with Text Grab the selection window does not (or should not) go away, so the user can try to select the word again. Here is a GIF showing the retry, also the OCR engine must have sensed it was being recorded because it does a much better job than when I wasn't recording 😅

TextGrab-Retry-Demo In this gif what is happening for each selection:

  1. OCR Engine had a non-empty result "Heuntedahren—", the result was put into the textbox and the selection window closes
  2. OCR engine had an empty result, the selection window remained in place
  3. Another empty result, window remains
  4. Non-empty result "Heruntedahren—", the result put into the textbox and the selection window closes
  5. OCR Engine had a non-empty result "Speschem", the result was put into the textbox and the selection window closes
  6. OCR engine had an empty result, the selection window remained in place
  7. OCR Engine had a non-empty result "pecc", the result was put into the textbox and the selection window closes

TheJoeFin avatar Aug 20 '22 19:08 TheJoeFin

  1. If the text is a bit small simply nothing happens: no log, nor error message, no new text on the clipboard. (See example image I created.)

For this I think I will revert to the behavior of Text Grab where if there is an empty result, the OCR Overlay remains in place to make another selection. Another thing Text Grab does when processing OCR is two passes of OCR to evaluate the current line height of the selected region and try to scale the image to an ideal line height where the OCR engine gets more reliable results. I did not add this logic into PowerOCR due to questions I had about memory usage and speed.

I can reproduce the same on TextGrab when selecting. At least sometimes and especially when selecting the word "Herunterfahren", "Ausschalten" or "Speichern".

OCR sometimes does fail to get a result, but with Text Grab the selection window does not (or should not) go away, so the user can try to select the word again. Here is a GIF showing the retry, also the OCR engine must have sensed it was being recorded because it does a much better job than when I wasn't recording 😅

I can agree that editor window keeps open. What I mean with reproduce is the empty results of ocr engine.

Let's close discussion here as this is a bug in ocr engine and not in PowerOCR.

htcfreek avatar Aug 20 '22 19:08 htcfreek

Thanks a lot @TheJoeFin , it seems to be working great! I'll take a look now to add installer, signing, logs and some telemetry.

jaimecbernardo avatar Aug 22 '22 09:08 jaimecbernardo

@jaimecbernardo Don't forget BugReportTol.

htcfreek avatar Aug 22 '22 10:08 htcfreek

Some further changes I think are needed here, but I'll look into them as well. Win+Shift+O already is used by VCM. I'm thinking of replacing with Win+Shift+R instead.

Also, it's using Global Keyboard Hooks from the C# executable. We ended up disabling this on ColorPicker before due to C# doing lots of marshalling every time.a key was pressed. Given this, I'll add some code to use the runner and an event to bring up OCR Overlay when starting from runner. This way it's still possible to test PowerOCR when running it directly and it won't consume as much CPU / delay input when started from the runner in normal conditions.

Should also block the overlay from being created twice by pressing the shortcut twice.

jaimecbernardo avatar Aug 22 '22 11:08 jaimecbernardo

Thanks a lot for the work @TheJoeFin . I think it's battle ready now with the latest changes. It's ready for review @stefansjfw .

jaimecbernardo avatar Aug 23 '22 17:08 jaimecbernardo

Please don't forget to add this to the issue templates.

Aaron-Junker avatar Aug 23 '22 18:08 Aaron-Junker

Just did. Going with minimum lovable product here. What's remaining in terms of features would go in different issues.

jaimecbernardo avatar Aug 23 '22 19:08 jaimecbernardo

@jaimecbernardo if you don't want to have this PowerToy's name start with the word "Power" what do you think about the name "OCR Copy"?

htcfreek avatar Aug 24 '22 09:08 htcfreek

@jaimecbernardo if you don't want to have this PowerToy's name start with the word "Power" what do you think about the name "OCR Copy"?

Was about to add a comment about that. @TheJoeFin, are you ok with us changing the name of the PowerToys in order to not contain the word "Power"? We've been avoiding that on new utilities. Another internal ideas is naming it "Screen to Text", in the sense that it's descriptive of functionality.

jaimecbernardo avatar Aug 24 '22 09:08 jaimecbernardo

@jaimecbernardo if you don't want to have this PowerToy's name start with the word "Power" what do you think about the name "OCR Copy"?

Was about to add a comment about that. @TheJoeFin, are you ok with us changing the name of the PowerToys in order to not contain the word "Power"? We've been avoiding that on new utilities. Another internal ideas is naming it "Screen to Text", in the sense that it's descriptive of functionality.

If we add the context menu for images. Then the source is an image and not the screen.

htcfreek avatar Aug 24 '22 10:08 htcfreek

@jaimecbernardo if you don't want to have this PowerToy's name start with the word "Power" what do you think about the name "OCR Copy"?

Was about to add a comment about that. @TheJoeFin, are you ok with us changing the name of the PowerToys in order to not contain the word "Power"? We've been avoiding that on new utilities. Another internal ideas is naming it "Screen to Text", in the sense that it's descriptive of functionality.

I am onboard with changing the name away from PowerOCR. "OCR Copy" is a good name, when thinking up a name I did web searches and found many of the "easy OCR" "quick OCR" "Fast OCR" etc. all already in use.

TheJoeFin avatar Aug 24 '22 13:08 TheJoeFin

So, the plan is to currently merge as "PowerOCR" and change it later if needed. Thank you!

jaimecbernardo avatar Aug 24 '22 16:08 jaimecbernardo

@jaimecbernardo Don't forget the github label.

htcfreek avatar Aug 24 '22 17:08 htcfreek

  1. This is amazing
  2. Lets change keystroke. R just seems too much like 'recording' and would like to keep that open
    1. Win+Shift+O?
    2. Win+Shift+T?

crutkas avatar Aug 25 '22 04:08 crutkas

  1. Win+Shift+O?
  2. Win+Shift+T?

Win+Shift+O is used by VCM already for camera muting. Win+Shift+T should be OK. Going to make the change and merge it in.

jaimecbernardo avatar Aug 25 '22 07:08 jaimecbernardo

  1. Win+Shift+O?
  2. Win+Shift+T?

Win+Shift+O is used by VCM already for camera muting. Win+Shift+T should be OK. Going to make the change and merge it in.

Although, Win+T and Win+Shift+T are shortcuts for cycling forward and backwards on the taskbar icons. Going to check if it can be overridden on Windows 11 as well and then apply the change.

jaimecbernardo avatar Aug 25 '22 07:08 jaimecbernardo

Tested locally, got a crash once during OCR:

 	[Exception] System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(int errorCode, System.IntPtr errorInfo)	Unknown
 	[Exception] System.Windows.Clipboard.Flush()	Unknown
 	[Exception] System.Windows.Clipboard.CriticalSetDataObject(object data, bool copy)	Unknown
 	[Exception] System.Windows.Clipboard.SetDataInternal(string format, object data)	Unknown
 	[Exception] System.Windows.Clipboard.SetText(string text, System.Windows.TextDataFormat format)	Unknown
 	[Exception] System.Windows.Clipboard.SetText(string text)	Unknown
>	[Exception] PowerOCR.OCROverlay.RegionClickCanvas_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e) Line 218	C#
 	[Exception] System.Threading.Tasks.Task.ThrowAsync.AnonymousMethod__128_0(object state)	Unknown
 	[Exception] System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs)	Unknown
 	[Exception] System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler)	Unknown
 	[Exception] System.Windows.Threading.DispatcherOperation.InvokeImpl()	Unknown
 	[Exception] MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(object obj)	Unknown
 	[Exception] System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)	Unknown
 	00007ffe31344fd9()	Unknown
 	[Managed to Native Transition]	
 	System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()	Unknown
 	MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext executionContext, System.Threading.ContextCallback callback, object state)	Unknown
 	System.Windows.Threading.DispatcherOperation.Invoke()	Unknown
 	System.Windows.Threading.Dispatcher.ProcessQueue()	Unknown
 	System.Windows.Threading.Dispatcher.WndProcHook(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled)	Unknown
 	MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled)	Unknown
 	MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o)	Unknown
 	System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs)	Unknown
 	System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler)	Unknown
 	System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs)	Unknown
 	MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam)	Unknown
 	[Native to Managed Transition]	
 	00007ffe3268e858()	Unknown
 	00007ffe3268e299()	Unknown
 	[Managed to Native Transition]	
 	System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame)	Unknown
 	System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame frame)	Unknown
 	System.Windows.Threading.Dispatcher.Run()	Unknown
 	System.Windows.Application.RunDispatcher(object ignore)	Unknown
 	System.Windows.Application.RunInternal(System.Windows.Window window)	Unknown
 	System.Windows.Application.Run()	Unknown
 	PowerOCR.App.Main()	Unknown

image

yuyoyuppe avatar Aug 25 '22 16:08 yuyoyuppe

@yuyoyuppe We should probably wrap the Clipboard access in a try block

https://github.com/microsoft/PowerToys/blob/eedea3159c3554e8572bdfcf20e2749aa073fca1/src/modules/PowerOCR/PowerOCR/OCROverlay.xaml.cs#L275

and probably log an error if access to the clipboard fails.

TheJoeFin avatar Aug 25 '22 19:08 TheJoeFin

@yuyoyuppe We should probably wrap the Clipboard access in a try block

https://github.com/microsoft/PowerToys/blob/eedea3159c3554e8572bdfcf20e2749aa073fca1/src/modules/PowerOCR/PowerOCR/OCROverlay.xaml.cs#L275

and probably log an error if access to the clipboard fails.

How does color picker safe guard this.

crutkas avatar Aug 25 '22 21:08 crutkas

@crutkas try-catch with log. https://github.com/microsoft/PowerToys/blob/main/src/modules/colorPicker/ColorPickerUI/Helpers/ClipboardHelper.cs

@TheJoeFin I already love this tool! 😃 I have two small nits:

  • Hide the window from the taskbar
  • Strange behaviour: background disappear on single click when no text is detected but PowerOCR still opened

https://github.com/microsoft/PowerToys/blob/eedea3159c3554e8572bdfcf20e2749aa073fca1/src/modules/PowerOCR/PowerOCR/OCROverlay.xaml.cs#L265

davidegiacometti avatar Aug 25 '22 22:08 davidegiacometti

Would love the ability to run OCR in bulk on a folder of pictures, and have the ability to search images by text it contains. Probably out of the scope of this but would be incredibly handy for bulk scanning or finding things in a screenshots folder

astandarduser avatar Aug 25 '22 23:08 astandarduser

we should move to clipboard logic to common lib so we reuse same logic.

crutkas avatar Aug 25 '22 23:08 crutkas

@astandarduser please create new issue as "new feature" request. Would love to understand more the "why" but very interesting concept

crutkas avatar Aug 25 '22 23:08 crutkas

This is SOO nice. I did use Text Grab but having this as part of PowerToys will make it something I know will just always be there for me.

Nits:

  • The link for "Leam(sic) more about PowerOCR" does not really work. <- Funny, "Leam" is a typo, OCR fail...
  • Pressing Win before you finish the text selection puts you in a weird state. It should ignore Win or treat it like Esc.
  • Not selecting anything but just left-click on the mouse does not revert the cursor or mode. It's seems to be still in OCR mode but the screen is not dimed.
  • Why not call this "Text Grab" here in PowerToys? Or "PowerTextGrab" (PTG). I think that having "OCR" in the name can lead people to think its a "Powerful OCR tool" that can be use to process files an other things, when it's really just (a fantastic) quick "text grabber" for the screen. Maybe it's "Screen Text Grabber", or "PowerTextPlucker", or "VisualTextCopy"...

Thank you for making the "dimming" be instant and not fade. If you do change to fade, make that an optional thing please.

jefflord avatar Aug 26 '22 00:08 jefflord