From 004199ef8fdff236abfc9989a500096e235a9a61 Mon Sep 17 00:00:00 2001 From: My Spaghetti <31696646+myspaghetti@users.noreply.github.com> Date: Wed, 28 Oct 2020 14:37:28 +0200 Subject: [PATCH] fix ocr for High Sierra --- macos-guest-virtualbox.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/macos-guest-virtualbox.sh b/macos-guest-virtualbox.sh index 30eba90..1c909c1 100755 --- a/macos-guest-virtualbox.sh +++ b/macos-guest-virtualbox.sh @@ -2,7 +2,7 @@ # Push-button installer of macOS on VirtualBox # (c) myspaghetti, licensed under GPL2.0 or higher # url: https://github.com/myspaghetti/macos-virtualbox -# version 0.97.3 +# version 0.97.4 # Dependencies: bash coreutils gzip unzip wget xxd dmg2img # Optional features: tesseract-ocr tesseract-ocr-eng @@ -1494,8 +1494,8 @@ function prompt_lang_utils_terminal() { animated_please_wait 30 for i in $(seq 1 60); do # try automatic ocr for about 5 minutes VBoxManage controlvm "${vm_name}" screenshotpng "${vm_name}_screenshot.png" 2>&1 1>/dev/null - ocr="$(tesseract "${vm_name}_screenshot.png" - --dpi 70 -l eng 2>/dev/null)" - regex='Language|English' # for zsh quoted regex compatibility + ocr="$(tesseract "${vm_name}_screenshot.png" - --psm 11 --dpi 72 -l eng 2>/dev/null)" + regex='Language|English|Fran.ais' # for zsh quoted regex compatibility if [[ "${ocr}" =~ ${regex} ]]; then animated_please_wait 20 send_enter @@ -1505,7 +1505,8 @@ function prompt_lang_utils_terminal() { kbspecial='CTRLprs F2 CTRLrls u ENTER t ENTER' # start Terminal send_special fi - if [[ "${ocr}" =~ Terminal\ Shell ]]; then + regex='Terminal.Shell|Terminal.*sh.?-' # for zsh quoted regex compatibility + if [[ "${ocr}" =~ ${regex} ]]; then sleep 2 return fi