Photoshop脚本之调试
系统:mac
创建test.scpt和test.jsx
command+空格,打开 脚本编辑器(applescript)
脚本编辑器打开test.scpt
输入:
tell application "Adobe Photoshop CC 2015" -- 'do javascript' runs any arbitrary JS. -- We're using the #include feature to run another -- file. (That's an Adobe extension to JS.) -- -- You have to pass a full, absolute path to #include. -- -- The documentation alleges that 'do javascript' -- can be passed an AppleScript file object, but -- I wasn't able to get that to work. do javascript "#include ~/test.jsx" end tell
在test.jsx中输入:
function print(mess){ alert(mess) } print('test')
然后在脚本编辑器里点击三角形的运行按钮:
即可看到输出结果!
也可以在命令行运行:osascript test.scpt
自己创建的test.scpt文件可能在保存的时候报错,所以可以先打开applescript, 新建文件,然后保存成test.scpt
参考链接:http://stackoverflow.com/questions/3846626/is-it-possible-to-execute-jsx-scripts-from-outside-extendscript
黄世宇/Shiyu Huang's Personal Page:https://huangshiyu13.github.io/