-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathus-android-delete.jsx
70 lines (51 loc) · 1.11 KB
/
us-android-delete.jsx
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
/*!
* Android Assets for Photoshop
* =============================
*
* Version: 1.0.0
* Author: Vladislav Krot
* Licensed under the MIT license
*/
// Photoshop variables
var originalResolution = 2;
var resolutionsObj = {
xxxxhdpi : {
density : 6.0/originalResolution
},
xxxhdpi : {
density : 4.0/originalResolution
},
xxhdpi : {
density : 3.0/originalResolution
},
xhdpi : {
density : 2.0/originalResolution
},
hdpi : {
density : 1.5/originalResolution
},
mdpi : {
density : 1.0/originalResolution
}
};
// Initialize
init();
function init() {
//resize and save
for(resolution in resolutionsObj) {
deleteFile(resolution);
}
}
function deleteFile(resolution){
var split = app.activeDocument.activeLayer.name.split(":");
var fileName;
if(split.length != 2){
fileName = app.activeDocument.activeLayer.name;
}else{
fileName=split[0];
}
fileName = fileName.replace(/\.[^\.]+$/, '');
var docFolder = Folder(app.activeDocument.path + '/drawable-' + resolution);
var saveFile = File(docFolder + "/" + fileName + ".png");
saveFile.remove();
}