Last active
February 28, 2023 02:12
-
-
Save benigumocom/b98f899af8ad674905fd0e807d122f1a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| screencapture -i -c -o | |
| tmp_file=$(mktemp -t qr_code.XXXXXXXXXX).png | |
| osascript <<EOF | |
| set png_data to the clipboard as «class PNGf» | |
| set the_file to open for access POSIX path of (POSIX file "$tmp_file") with write permission | |
| write png_data to the_file | |
| close access the_file | |
| EOF | |
| text=$(zbarimg --quiet --raw "$tmp_file") | |
| # text=$(zxing -c "$tmp_file" | tail -n +2 | cut -d , -f 4) # only first detected | |
| if [ -n "$text" ]; then | |
| echo "$text" | |
| else | |
| echo "No QR code found in selection." | |
| fi | |
| # qlmanage -p "$tmp_file" >& /dev/null # show captured image | |
| rm "$tmp_file" |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
【スマホ・カメラ不要】Mac上でQRコードを スクリーンキャプチャ→テキスト化 するスクリプト
👉 https://android.benigumo.com/20230227/mac-qr-reader/