bash スクリプトの osascrip 行に小さな問題があります。Applescript の「リストから選択」ダイアログを介して bash スクリプトが呼び出され、if [[ $* = *"Option 1... selection タグを介してオプションを定義できます。
友人が私に osascript 行をくれました。「ファイルを選択」ダイアログが表示され、物事を選択するために機能しますが、「キャンセル」ボタンも「ファイルを選択」ダイアログをトリガーします。
OKとキャンセルの両方がファイルの選択ダイアログをトリガーするため、osascript行が最後近くでどこか不完全であると感じます。
bash スクリプトでは次のようになります。
#!/bin/bash
WORKDIR="$(dirname "$0")/"
STARTUPFILE="$(/usr/bin/osascript -e "tell application \"System Events\" to activate" -e "tell application \"System Events\" to set thefile to choose file with prompt \"Choose something here\"" -e "do shell script (\"echo \"&(quoted form of POSIX path of thefile as Unicode text)&\"\")")"
if [[ $* = *"Option 1 from Applescript"* ]]; then
cp -R "$STARTUPFILE/" "somewhere else"
do other stuff with "$STARTUPFILE...
osascript 行でキャンセル オプションが欠落している場所と、それを実装する方法を教えてください。