Run illustrator script from python

What I want to do

Adobe illustrator is convenient because you can automate various tasks with scripts! You can have the folder monitored and work automatically when data comes in, (Detailed in Illustrator CS Automation Strategy) Then, the illustrator will freeze and will not accept any operations from the outside. Let's monitor the folder with python, and if data comes in It would be convenient if I could execute the script prepared in advance ...

environment

Windows7(64bit) python2.7 Adobe illustrator CS6

Library to use

It seems that you can execute an external program by using subprocess. It's not just about hitting commands! Convenient!

Actual code

hello.jsx


alert("hello! from python...")

execute_jsx.py


# -*- coding: utf-8 -*-

import subprocess
import os

currentdir = os.getcwd()

illustrator = "C:\Program Files\Adobe\Adobe Illustrator CS6 (64 Bit)\Support Files\Contents\Windows\Illustrator.exe"
hello = "\\".join([currentdir, "hello.jsx"])    #Specify absolute path

#Run JSX
subprocess.call([illustrator, hello])

Remarks

If you change the path of illustrator to Photoshop, the script of Photoshop will work. But the essential inDesign doesn't seem to work. This is what I want to process from the outside, but hmm ...

Besides, it seems that you can use win32com to start a simple application. For passing variables, I once output the variables to an appropriate file, but I think there is probably a smarter way.

Recommended Posts

Run illustrator script from python
Run python from excel
Run a Python script from a C # GUI application
Run a python script from excel (using xlwings)
Execute Python script from batch file
Run Aprili from Python with Orange
Python error detection run from Powershell
Run Python scripts synchronously from C #
Run Ansible from Python using API
Run Python Scripts from Cisco Memorandum_EEM
How to run a Python program from within a shell script
Script python file
Run Cloud Dataflow (Python) from App Engine
python script skeleton
Python script profiling
Import python script
sql from python
Run the Python interpreter in a script
MeCab from Python
Use Django from a local Python script
How to run a Maya Python script
Create a New Todoist Task from Python Script
"Python Kit" that calls a Python script from Swift
Call a Python script from Embedded Python in C ++ / C ++
Run VMware vSphere 6 vSphere API with Python script (pyvmomi)
Run a Python file from html using Django
Use thingsspeak from python
Touch MySQL from Python 3
Run Python with VBA
Operate Filemaker from Python
Use fluentd from python
Run prepDE.py with python3
Changes from Python 2 to Python 3.0
Python from or import
Use MySQL from Python
Install python from source
Execute command from Python
Run Blender with python
Operate neutron from Python!
DynamoDB Script Memo (Python)
Use MySQL from Python
Operate LXC from Python
Manipulate riak from python
Force Python from Fortran
Use BigQuery from python.
Run BigQuery from Lambda
Execute command from python
Cloud Run tutorial (python)
[Python] Read From Stdin
Use mecab-ipadic-neologd from python
Run iperf with python
Run Python from Excel VBA with xlwings & tutorial supplement
A memorandum to run a python script in a bat file
Get the return code of the Python script from bat
Python script to create a JSON file from a CSV file
Run iphone safari from mac with python + selenium + safari-webdriver
Deep Python learned from DEAP
Run Openpose on Python (Windows)
Run python with PyCharm (Windows)
Grammar features added from Python3.6
Cheating from PHP to Python