-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathSmart Layer Export.jsx
executable file
·48 lines (38 loc) · 1.26 KB
/
Smart Layer Export.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
// Copyright 2014 Tom Byrne
var file;
try{
smartExport = {};
var classpath = "SmartLayerExport";
smartExport.appId = "org.tbyrne.smartLayerExport";
if($.os.toLowerCase().indexOf("macintosh")!=-1){
smartExport.directory = decodeURI(app.path + '/Presets.localized/' + app.locale + "/" + classpath);
}else{
smartExport.directory = decodeURI(app.path + '/Presets/' + app.locale + "/" + classpath);
}
var geo_dynamic = new Folder(smartExport.directory);
var scripts = geo_dynamic.getFiles();
for(var i=0; i<scripts.length; ++i){
file = scripts[i];
if(file instanceof File && file.toString().indexOf(".jsx")!=-1){
$.evalFile (file);
}
}
}catch(e){
if(file)alert("Error loading script: "+file+"\n"+e);
else alert("Error initialising:\n"+e);
}
var doc;
try{
doc = app.activeDocument;
}catch(e){}
if(!doc || !app.documents.length){
alert("Please open a document before running this command");
}else{
try{
var toolBuilder = new smartExport.ExportToolBuilder(app.activeDocument, "Smart Layer Export");
var loadSuccess = toolBuilder.loadPrefLayer("Export Settings", "nyt_exporter_info");
if (loadSuccess) toolBuilder.showDialog(true, true, true, true);
}catch(e){
alert("Error opening panel:\n"+e);
}
}