-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.command
More file actions
71 lines (57 loc) · 2.61 KB
/
setup.command
File metadata and controls
71 lines (57 loc) · 2.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
DIR="$(cd "$(dirname "$0")" && pwd)"
# Python3 を探す
PYTHON=""
for p in \
"/Library/Frameworks/Python.framework/Versions/3.13/bin/python3" \
"/Library/Frameworks/Python.framework/Versions/3.12/bin/python3" \
"/Library/Frameworks/Python.framework/Versions/3.11/bin/python3" \
"/opt/homebrew/bin/python3" \
"/usr/local/bin/python3" \
"/usr/bin/python3"; do
if [ -x "$p" ]; then
PYTHON="$p"
break
fi
done
if [ -z "$PYTHON" ]; then
osascript -e 'display alert "Python3 が見つかりません" message "https://www.python.org/ からPython3をインストールしてから、もう一度 setup.command を実行してください。" as critical'
exit 1
fi
# 必要なライブラリを確認・インストール
MISSING=""
"$PYTHON" -c "import numpy" 2>/dev/null || MISSING="$MISSING numpy"
"$PYTHON" -c "import PIL" 2>/dev/null || MISSING="$MISSING pillow"
"$PYTHON" -c "import tkinterdnd2" 2>/dev/null || MISSING="$MISSING tkinterdnd2"
if [ -n "$MISSING" ]; then
osascript -e 'display dialog "必要なライブラリをインストールします。\n1〜2分かかります。しばらくお待ちください。" buttons {"OK"} default button "OK"'
"$PYTHON" -m pip install $MISSING --quiet
if [ $? -ne 0 ]; then
osascript -e 'display alert "インストールに失敗しました" message "インターネット接続を確認してから、もう一度 setup.command を実行してください。" as critical'
exit 1
fi
fi
# 完了 → Automator手順を案内
osascript << OSASCRIPT
display dialog "ライブラリのインストールが完了しました!
次に Iro.app を作成します。
以下の手順で進めてください:
【手順】
1. Automator を開く
→ Spotlight(Command+Space)で「Automator」と入力してEnter
2. 「新規書類」→「アプリケーション」→「選択」
3. 左の検索欄に「シェル」と入力
→「シェルスクリプトを実行」をダブルクリック
4. 右側のテキスト欄を全て消して以下を貼り付ける:
----------------------------------------
cd \"$DIR\"
\"$PYTHON\" \"$DIR/app.py\"
----------------------------------------
5. Command+S で保存
→ ファイル名:Iro
→ 保存先:デスクトップ
6. デスクトップの Iro.app を右クリック→「開く」→「開く」
※ 初回のみこの操作が必要です
※ 2回目以降はダブルクリックで起動できます
詳しい手順は README.md を参照してください。" buttons {"OK"} default button "OK"
OSASCRIPT