-
Notifications
You must be signed in to change notification settings - Fork 0
/
svg2ai.py
45 lines (31 loc) · 876 Bytes
/
svg2ai.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import subprocess
import sys
import time
import os
ILLUSTRATOR_BIN = r"/Applications/Adobe Illustrator CC/Adobe Illustrator.app/Contents/MacOS/Adobe Illustrator"
SCRIPT = "svg2ai.jsx"
fcount = len(sys.argv[1:])/2
files = []
for i in range(fcount):
files.append((sys.argv[2*i+1], sys.argv[2*i+2]))
fid = file("filenames.txt", 'w')
for f in files:
fid.write("%s %s\n" % f)
fid.close()
starttime = time.time()
sp = subprocess.Popen([ILLUSTRATOR_BIN, SCRIPT])
print "sleeping on execution"
time.sleep(10)
# quitting -- all this because app.quit segfaults
waiting = True
while waiting:
waiting = False
for f_in, f_out in files:
if os.path.exists(f_out):
ftime = os.path.getmtime(f_out)
if ftime < starttime:
waiting = True
else:
waiting = True
time.sleep(2)
sp.terminate()