-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathPSD.action.js
56 lines (52 loc) · 1.45 KB
/
PSD.action.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
/**
* @author [email protected]
* @20130707
* PSD 常用动作接口
* @depands:PSD.jsx
*/
#include "PSD.jsx"
PSD.action = {
/**
* 创建快照
*/
createSnapshot: function() {
var desc = new ActionDescriptor();
var sref = new ActionReference();
sref.putClass(charIDToTypeID("SnpS"));
desc.putReference(charIDToTypeID("null"), sref);
var fref = new ActionReference();
fref.putProperty(charIDToTypeID("HstS"), charIDToTypeID("CrnH"));
desc.putReference(charIDToTypeID("From"), fref );
var now = new Date(),
month = now.getMonth(),
date = now.getDate(),
hour = now.getHours(),
minute = now.getMinutes(),
second = now.getSeconds();
var dateStr = (month + 1) + "-" + date + " " + hour + ":" + minute + ":" + second;
var sName = "histroy-"+ dateStr;
desc.putString( charIDToTypeID( "Nm " ), sName);
executeAction(charIDToTypeID("Mk "), desc, DialogModes.NO );
return sName;
},
/**
* 清除切片
*/
clearSlices: function() {
var idDlt = charIDToTypeID( "Dlt " );
var desc300 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref158 = new ActionReference();
var idslice = stringIDToTypeID( "slice" );
var idOrdn = charIDToTypeID( "Ordn" );
var idAl = charIDToTypeID( "Al " );
ref158.putEnumerated( idslice, idOrdn, idAl );
desc300.putReference( idnull, ref158 );
executeAction( idDlt, desc300, DialogModes.NO );
},
/**
* 创建对话框
*/
showDialog: function() {
}
};