アプリケーションと.sh
ファイルがあります。ダブルクリックすると、その.sh
ファイルのアクセス許可を設定して実行するアップルスクリプトが必要です。以下は私のコードです:
set app_directory to POSIX path of ((container of (path to me)) as text)
tell application "Terminal" to do shell script "chmod 777 " & app_directory & " start.sh"
tell application "Terminal" to do shell script app_direcory & "start.sh"
しかし、次のエラーが発生します。
エラー「エイリアス \"Macintosh HD:Users:santhosh:Desktop:EPPFN ver1:Barcode Application_mac:test_app.app:\" のコンテナーをテキスト型にできません。」エイリアス「Macintosh HD:Users:santhosh:Desktop:EPPFN ver1:Barcode Application_mac:test_app.app:」のコンテナから数値 -1700 をテキストに
現在のパスを設定し、相対パスを使用してスクリプトを実行するにはどうすればよいですか。
編集:コードを次のように変更しました:
set x to POSIX file ((POSIX path of (path to me)) & "/..") as text
set thescript to ("chmod 777 " & x & "start.sh") as text
tell application "Terminal" to do shell script (thescript)
まだ運がない。