LoginSignup
14

More than 5 years have passed since last update.

PhotoshopのJavaScriptファイル(.jsx)をシェルスクリプト/コマンドラインから実行する(Mac)

Posted at

sample.shと同一階層にあるsample.jsxをPhotoshop CS5で実行する例。

sample.sh
#!/bin/sh

dirpath=$(cd $(dirname $0); pwd)
jsxpath="${dirpath}/sample.jsx"
photoshop='Adobe Photoshop CS5'

osascript -e "tell application \"${photoshop}\" to activate & do javascript file \"${jsxpath}\""
sample.jsx
alert('hello');

ただ、自分の環境では53:136: execution error: No result was returned from some part of this expression. (-2763)というAppleScriptのエラーが起こってしまうみたい。
どうすればいいのかな?

また他のAdobe製品もだいたい同じでいけるっぽいけど若干コードが異なったりパスの扱いが違う模様。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14