fix ocr for High Sierra
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user