-
Notifications
You must be signed in to change notification settings - Fork 0
/
Load.jsx
55 lines (36 loc) · 1.4 KB
/
Load.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
setMockup()
function setMockup () {
app.displayDialogs = DialogModes.NO;
var doc = app.activeDocument;
var folderLocale = Folder.selectDialog ( "Selecione o local para re-ajustar os arquivos.", "~" );
var destFolder = Folder.selectDialog( 'Selecione o destino onde serao salvos os EPS.', '~' );
var files = folderLocale.getFiles("*.TIF");
for( var i = 0; i < files.length; i++ ) {
open( files[i] )
var nameDocumment = getFileName();
try {
app.doAction("pattern","Mockups")
} finally {
app.doAction("mockup","Mockups")
setFileName( nameDocumment.replace(".tif", "") );
}
var tiffSaveOptions = new TiffSaveOptions();
tiffSaveOptions.imageCompression = TIFFEncoding.TIFFLZW
tiffSaveOptions.embedColorProfile = true;
tiffSaveOptions.layers = false;
tiffSaveOptions.transparency = false;
var targetFile = new File( destFolder + '/' + nameDocumment )
doc.saveAs( targetFile, tiffSaveOptions, true, Extension.LOWERCASE )
}
alert("Finalizado!")
}
function getFileName () {
app.displayDialogs = DialogModes.NO;
var doc = app.activeDocument;
var nameDocumment = doc.name
return nameDocumment;
}
function setFileName ( value ) {
var doc = app.activeDocument;
doc.artLayers.getByName("texto").textItem.contents = value;
}