どちらのコマンドも個別に実行された場合は機能しますが、Bashファイルでは機能しません。

どちらのコマンドも個別に実行された場合は機能しますが、Bashファイルでは機能しません。

Kubuntu 18.04.1を使用しています

私はspectacle(Kubuntuのスクリーンショットアプリ)とgocr(OCRツール)を使ってスクリーンショットからテキストを抽出しようとしています。

Konsole(KUbuntu端末)で順次コマンドを実行すると、

最初:

spectacle -r -b -n -o /home/UserName/Documents/Translate/input.jpg

第二:

gocr -i /home/UserName/Documents/Translate/input.jpg | xsel -b

効果がある

bashファイルを作成するとscreen_ts.shそしてコードを入力してください

#!/bin/bash
# Dependencies: gocr xsel

# Take Screenshot and Save it to a File
spectacle -r -b -n -o /home/UserName/Documents/Translate/input.jpg

# Extract text from the saved file
gocr -i /home/UserName/Documents/Translate/input.jpg | xsel -b

exit

Konsoleを開き、次のように入力します。./screen_ts.sh効果がある

ただし、ファイルを実行可能にしてダブルクリックするとスクリーンショットを撮りますが、クリップボードにテキストを保存することはありません。

繰り返しますが、次のようにカスタムショートカットを作成すると、

カスタムショートカット>トリガーAlt + Qとアクション/home/UserName/Documents/Translate/screen_ts.sh

KUbuntuカスタムショートカット

スクリーンショットを撮りますが、クリップボードにテキストを保存することはありません。ダブルクリックと同じ動作です。

どうしたの?

ベストアンサー1

おすすめ記事