用于与adobe photoshop通信的纯python实现
pyps的Python项目详细描述
photoshop连接
photoshop连接是在mit许可下发布的。它简单易懂,几乎不限制你使用photoshop连接所能做的事情。 More Information
连接到photoshop cs5.5的python tcp套接字。这很简单 包装类,以便于将任意javascript发送到photoshop和 接收脚本的结果。连接对象也有 将a jpeg写入当前文档的类文件对象的缩略图方法 在photoshop中打开。
有一个EventListener类可以订阅Photoshop中的事件。
示例
from pyps import Connection, EventListener conn = Connection() conn.connect(passwd='Swordfish') conn.send('alert("Hello");', True) print conn.send('$.version;', True) def callback(message, *args): print message.command print message.content def callback2(message, *args): print message.command print message.content print args listener = EventListener(conn) listener.start() listener.subscribe('foregroundColorChanged', callback) listener.subscribe('toolChanged', callback2, (True, 'xxx')) listener.subscribe('currentDocumentChanged', callback) ## -- We need to keep the EventListener alive while True: time.sleep(1.0)