-
Notifications
You must be signed in to change notification settings - Fork 93
Expand file tree
/
Copy pathLinkLayer.py
More file actions
32 lines (28 loc) · 793 Bytes
/
Copy pathLinkLayer.py
File metadata and controls
32 lines (28 loc) · 793 Bytes
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
# Link two layers so they move/transform together.
from appscript import k
from ps_connect import photoshop
ps = photoshop()
ps.settings.ruler_units.set(k.pixel_units)
if len(ps.documents()) < 1:
doc = ps.make(
new=k.document,
with_properties={
k.width: 320,
k.height: 240,
k.resolution: 72,
k.mode: k.RGB,
k.initial_fill: k.white,
},
)
else:
doc = ps.current_document()
a = doc.make(new=k.art_layer, with_properties={k.name: "A"})
b = doc.make(new=k.art_layer, with_properties={k.name: "B"})
try:
a.link(with_=b)
except Exception:
try:
a.linked_layers.set([b])
except Exception as exc:
print("link note:", exc)
print("Created layers to link:", a.name(), b.name())