-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
photoshop-javascript.js
104 lines (83 loc) · 2.87 KB
/
photoshop-javascript.js
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
function size(){
app.preferences.rulerUnits = Units.PIXELS;
if (Units.PIXELS == false){
alert("Had a problem, check if it's pixels!!")
}
// var width = new UnitValue("1080 pixels")
// var height = new UnitValue("1080 pixels")
var doc = app.activeDocument;
var width = doc.width;
var height = doc.height;
if (width == 1080 && height == 1080) {
// FEED
doc.guides.add(Direction.VERTICAL, 70.0);
doc.guides.add(Direction.VERTICAL, 204.281);
doc.guides.add(Direction.VERTICAL, 338.563);
doc.guides.add(Direction.VERTICAL, 472.844);
doc.guides.add(Direction.VERTICAL, 607.156);
doc.guides.add(Direction.VERTICAL, 741.438);
doc.guides.add(Direction.VERTICAL, 875.719);
doc.guides.add(Direction.VERTICAL, 1010.0);
doc.guides.add(Direction.VERTICAL, 540);
doc.guides.add(Direction.HORIZONTAL, 0.0);
doc.guides.add(Direction.HORIZONTAL, 154.281);
doc.guides.add(Direction.HORIZONTAL, 308.563);
doc.guides.add(Direction.HORIZONTAL, 462.844);
doc.guides.add(Direction.HORIZONTAL, 617.156);
doc.guides.add(Direction.HORIZONTAL, 771.438);
doc.guides.add(Direction.HORIZONTAL, 925.719);
doc.guides.add(Direction.HORIZONTAL, 1080.0);
alert("Enabled Tabs.");
}
if (width == 1080 && height == 1920) {
// STORY
doc.guides.add(Direction.VERTICAL, 540.0);
doc.guides.add(Direction.HORIZONTAL, 188);
doc.guides.add(Direction.HORIZONTAL, 1827);
doc.guides.add(Direction.VERTICAL, 67);
doc.guides.add(Direction.VERTICAL, 1046.5);
alert("Enabled Tabs.");
}
if (width == 2160 && height == 3840) {
// STORY
doc.guides.add(Direction.VERTICAL, 180);
doc.guides.add(Direction.HORIZONTAL, 1020);
doc.guides.add(Direction.HORIZONTAL, 2820);
doc.guides.add(Direction.VERTICAL, 1980);
doc.guides.add(Direction.VERTICAL, 540);
alert("Enabled Tabs.");
}
if (width == 1050 && height == 600) {
// CARD
doc.guides.add(Direction.VERTICAL, 33);
doc.guides.add(Direction.HORIZONTAL, 23.5);
doc.guides.add(Direction.HORIZONTAL, 577.5);
doc.guides.add(Direction.VERTICAL, 1024);
alert("Enabled Tabs.");
}
if (width == 1300 && height == 1300) {
// CARD
doc.guides.add(Direction.VERTICAL, 1220);
doc.guides.add(Direction.HORIZONTAL, 80);
doc.guides.add(Direction.HORIZONTAL, 650);
doc.guides.add(Direction.HORIZONTAL, 1220);
doc.guides.add(Direction.VERTICAL, 80);
doc.guides.add(Direction.VERTICAL, 650);
alert("Enabled Tabs.");
}
if (width == 8000 && height == 2000) {
// FEED
doc.guides.add(Direction.VERTICAL, 2000);
doc.guides.add(Direction.VERTICAL, 4000);
doc.guides.add(Direction.VERTICAL, 6000);
doc.guides.add(Direction.VERTICAL, 996.125);
doc.guides.add(Direction.HORIZONTAL, 100);
doc.guides.add(Direction.HORIZONTAL, 1900);
doc.guides.add(Direction.VERTICAL, 80);
alert("Enabled Tabs.");
}
}
size()
if(app.preferences.rulerUnits !== Units.PIXELS){
alert("Had a problem, check the size!");
}