Skip to content

Instantly share code, notes, and snippets.

@theodox
Created January 29, 2014 09:57
Show Gist options
  • Save theodox/8684889 to your computer and use it in GitHub Desktop.
Save theodox/8684889 to your computer and use it in GitHub Desktop.
import socket
HOST = '127.0.0.1'
PORT = 8789
def send_photoshop(msg):
'''
Expects a photoshop instance running a tcp server on HOST:PORT
'''
conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
conn.connect((HOST,PORT))
conn.send(msg)
r = conn.recv(4096)
conn.close()
return r
send_photoshop("alert hello_from_python") #show a dialog
send_photoshop("newLayer") #create a layer
send_photoshop("stop") #stop the server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment