-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathLayerComps-Artboard-To-Files.jsx
2793 lines (2468 loc) · 123 KB
/
LayerComps-Artboard-To-Files.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
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright 2007. Adobe Systems, Incorporated. All rights reserved.
// This script will apply each comp and then export to a file
// Written by Naoki Hada
// ZStrings and auto layout by Tom Ruark
// PNG support by Jeffrey Tranberry
// Artboard support by Antonio Costa
/*
@@@BUILDINFO@@@ Layer Comps & Artboards to Files.jsx 1.3.1
*/
/*
// ADD SCRIPT TO FILE SYSTEM
// BEGIN__HARVEST_EXCEPTION_ZSTRING
<javascriptresource>
<name>$$$/JavaScripts/LayerCompsArtboardsToFiles/Menu=Layer Comps & Artboards to Files...</name>
<category>scriptexport</category>
<menu>export</menu>
<enableinfo>PSHOP_DocHasLayerComps&&PSHOP_DocHasArtboards</enableinfo>
<eventid>cf34b502-2013-4d07-8431-1dfd634ee0cd</eventid>
<about>December 15th 2022 - Rombout Versluijs \r https://github.com/schroef/photoshop-scripts</about>
<terminology><![CDATA[<< /Version 1
/Events <<
/cf34b502-2013-4d07-8431-1dfd634ee0cd [($$$/JavaScripts/LayerCompsToABFiles/Action=Layer Comps & Artboards to Files) /noDirectParam <<
>>]
>>
>> ]]></terminology>
</javascriptresource>
// END__HARVEST_EXCEPTION_ZSTRING
*/
////////////////////////////////////////////////////////////
/*
TODO
• Webexport > resize to 72
• Foit action? Handy for big or higher res docs
• Check convertsRGB, it does this on layered
• Speed improvement layer cleaner > went from 122s to 20s for 4 artboards with 25 layers - 06012020
X Fix PSD export keep layers doesnt clean artboards. - 06012021
X Fix PSD export keep layers doesnt clean artboards. - 17122020 > not properly fixed
X Add templates gitgub issues - 17122020
X Add WEBP from other script - 20240124
V Add option to use without artboards - 20240124
X Rebuild Dialog with scriptui - 20240124
*/
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
/*
v1.3.1 - 20240807
Fixed
- Issue when comment where added. wrong method of adding to fileNameBody string
v1.3.0 - 20240124
Added
- Option to use script without artboards
v1.2.9 - 15122022
Fixed
- TypeError: undefined is not an object > Warning dialog when no artboards are available. enableinfo in script header can only do one check, we check for layercomps, so manual alert is needed for artboards
- check if single artboard is select from dropdown, warning dialog
Changed
- Added extra check menu for File > Export, it will now be enabled only their are artboards and layer comps available. This makes the manual checks absolute
v1.2.8 - 24022022
Fixed
- Issue cause by abIndex > TypeError: undefined is not an object
^ i used twice artbrdIndex -= 1 which caused index to be -1
v1.2.7 - 14092021
Changed
- Temp turn off "NO artoard selection"
v1.2.6 - 14092021
Changed
- Panel organisation
v1.2.5 - 14092021
Added
- Option to add Suffix in file name
- Panel organisation
v1.2.4 - 14092021
Added
- Checkbox to open destination when done.
- Checkbox to add/leave out layer comp name
v1.2.3 - 10092021
Fix
- Hotfix for single AB export getting wrong indexnumber due to Dropdown index being different from actual AB index
Added
- Checkbox to give alert when done.
v1.2.2 - 06092021
Fix
- Issue wuth flattened files single artboards and layercomps export other then JPG
v1.2.1 - 12072021
Fix
- Issue 002 > results in error checking artboard names before dialog shows
v1.2.0 - 06072021
Fix
- Try Fix artboard is ps 22.4.0
- Missing export flattened method > accidently commented it out while testing layered methods
v1.1.9 - 07012021
Added
- switch to fullscreen mode, ui doesnt need to update > seems faster
v1.1.8 - 07012021
Fixed
- Transparent Export, Layered PSD and artboards > Wasnt working on OSX
Added
- PDF layers
v1.1.8 - 06012021
Fixed
- Transparent Export, Layered PSD and artboards > Now single artboards are exported properly
Changed
- Better cleaning of docs for layers and transparent files
- When no artboard is selected dialog shows again > prior it would close and script need to be selected again
- Speed Improvement > The more layers you had the slower it was > Now its blazing!!!
25 layers on 4 artboards
20.652 New time
122.169 Old time
v1.1.7 - 17122020
Fixed
- Exporting artboards with transparency cleans artboards properly > still had issues single artboards
v1.1.6 - 17122020
Fixed
- #146 1302 No such elelement > app.activeDocument.colorProfileName
VERSION
v1.1.5 - August 3 2020
*/
////////////////////////////////////////////////////////////
// enable double clicking from the Macintosh Finder or the Windows Explorer
#target photoshop
// debug level: 0-2 (0:disable, 1:break on error, 2:break at beginning)
// $.level = 0;
// debugger; // launch debugger on next line
// on localized builds we pull the $$$/Strings from a .dat file, see documentation for more details
$.localize = true;
//=================================================================
// Globals
//=================================================================
// UI strings to be localized
var strTitle = localize("$$$/JavaScripts/LayerCompsToABFiles/Title=Export Layer Comps & Artboards v1.3.1");
var strButtonRun = localize("$$$/JavaScripts/LayerCompsToABFiles/Run=Run");
var strButtonCancel = localize("$$$/JavaScripts/LayerCompsToABFiles/Cancel=Cancel");
var strHelpText = localize("$$$/JavaScripts/LayerCompsToABFiles/Help=Please specify the format and location for saving each layer comp as a file.");
var strLabelDestination = localize("$$$/JavaScripts/LayerCompsToABFiles/Destination=Destination:");
var strButtonBrowse = localize("$$$/JavaScripts/LayerCompsToABFiles/Browse=&Browse...");
var strLabelFileNamePrefix = localize("$$$/JavaScripts/LayerCompsToABFiles/FileNamePrefix=File Name Prefix:");
var strLabelFileNameSuffix = localize("$$$/JavaScripts/LayerCompsToABFiles/FileNameSuffix=File Name Suffix:");
var strCheckboxSelectionOnly = localize("$$$/JavaScripts/LayerCompsToABFiles/SelectedOnly=&Selected Layer Comps Only");
var strcbSelectionHelp = localize("$$$/JavaScripts/LayerCompsToABFiles/SelectedHelp=Uses selected Layer Lomp only");
var strddUseComp = localize("$$$/JavaScripts/LayerCompsToABFiles/DDuseComp=Select Layer Comp from document");
var strCheckboxAddLyrCompName = localize("$$$/JavaScripts/LayerCompsToABFiles/AddLyrCompName=&Include Layer Comp Name");
var strCheckboxAddCompComment = localize("$$$/JavaScripts/LayerCompsToABFiles/AddCompComment=&Include Layer Comp Comment");
var strLabelFileType = localize("$$$/JavaScripts/LayerCompsToABFiles/FileType=File Type:");
var strCheckboxIncludeICCProfile = localize("$$$/JavaScripts/LayerCompsToABFiles/IncludeICC=&Include ICC Profile");
var strJPEGOptions = localize("$$$/JavaScripts/LayerCompsToABFiles/JPEGOptions=JPEG Options:");
var strLabelQuality = localize("$$$/JavaScripts/LayerCompsToABFiles/Quality=Quality:");
var strPSDOptions = localize("$$$/JavaScripts/LayerCompsToABFiles/PSDOptions=PSD Options:");
var strPSDlayers = localize("$$$/JavaScripts/LayerCompsToABFiles/PSDlayers=Save Layers");
var strCheckboxMaximizeCompatibility = localize("$$$/JavaScripts/LayerCompsToABFiles/Maximize=&Maximize Compatibility");
var strTIFFOptions = localize("$$$/JavaScripts/LayerCompsToABFiles/TIFFOptions=TIFF Options:");
var strTIFFlayers = localize("$$$/JavaScripts/LayerCompsToABFiles/TIFFlayers=Save Layers");
var strCheckboxTIFFTransparency = localize("$$$/JavaScripts/ExportLayersToFiles/Transparency=Transparency");
var strLabelImageCompression = localize("$$$/JavaScripts/LayerCompsToABFiles/ImageCompression=Image Compression:");
var strNone = localize("$$$/JavaScripts/LayerCompsToABFiles/None=None");
var strPDFOptions = localize("$$$/JavaScripts/LayerCompsToABFiles/PDFOptions=PDF Options:");
var strPDFlayers = localize("$$$/JavaScripts/LayerCompsToABFiles/PDFlayers=Save Layers");
var strLabelEncoding = localize("$$$/JavaScripts/LayerCompsToABFiles/Encoding=Encoding:");
var strTargaOptions = localize("$$$/JavaScripts/LayerCompsToABFiles/TargaOptions=Targa Options:");
var strLabelDepth = localize("$$$/JavaScripts/LayerCompsToABFiles/Depth=Depth:");
var strRadiobutton16bit = localize("$$$/JavaScripts/LayerCompsToABFiles/Bit16=16bit");
var strRadiobutton24bit = localize("$$$/JavaScripts/LayerCompsToABFiles/Bit24=24bit");
var strRadiobutton32bit = localize("$$$/JavaScripts/LayerCompsToABFiles/Bit32=32bit");
var strBMPOptions = localize("$$$/JavaScripts/LayerCompsToABFiles/BMPOptions=BMP Options:");
var strAlertSpecifyDestination = localize("$$$/JavaScripts/LayerCompsToABFiles/SpecifyDestination=Please specify destination.");
var strAlertDestinationNotExist = localize("$$$/JavaScripts/LayerCompsToABFiles/DestionationDoesNotExist=Destination does not exist.");
var strTitleSelectDestination = localize("$$$/JavaScripts/LayerCompsToABFiles/SelectDestination=Select Destination");
var strAlertDocumentMustBeOpened = localize("$$$/JavaScripts/LayerCompsToABFiles/OneDocument=You must have a document open to export!");
var strAlertNoLayerCompsFound = localize("$$$/JavaScripts/LayerCompsToABFiles/NoComps=No layer comps found in document!");
var strAlertNoLayerCompsSelected = localize("$$$/JavaScripts/LayerCompsToFiles/NoSelectedComps=No layer comps selected in document!");
var strAlertWasSuccessful = localize("$$$/JavaScripts/LayerCompsToABFiles/Success= was successful.");
var strUnexpectedError = localize("$$$/JavaScripts/LayerCompsToABFiles/Unexpectedd=Unexpected error");
var strMessage = localize("$$$/JavaScripts/LayerCompsToABFiles/Message=Layer Comps To Files action settings");
var stretQuality = localize("$$$/locale_specific/JavaScripts/LayerCompsToABFiles/ETQualityLength=30");
var stretDestination = localize("$$$/locale_specific/JavaScripts/LayerCompsToABFiles/ETDestinationLength=350");
var strddFileType = localize("$$$/locale_specific/JavaScripts/LayerCompsToABFiles/DDFileType=100");
var strpnlOptions = localize("$$$/locale_specific/JavaScripts/LayerCompsToABFiles/PNLOptions=100");
var strCreateFolder = localize("$$$/JavaScripts/LayerCompsToABFiles/CreateFolder=The folder does not exist. Do you wish to create it?^r");
var strCouldNotCreate = localize("$$$/JavaScripts/LayerCompsToABFiles/CouldNotCreate=The folder could not be created.");
var strPNG8Options = localize("$$$/JavaScripts/ExportLayersToFiles/PNG8Options=PNG-8 Options:");
var strCheckboxPNGTransparency = localize("$$$/JavaScripts/ExportLayersToFiles/Transparency=Transparency");
var strCheckboxPNGInterlaced = localize("$$$/JavaScripts/ExportLayersToFiles/Interlaced=Interlaced");
var strPNG24Options = localize("$$$/JavaScripts/ExportLayersToFiles/PNG24Options=PNG-24 Options:");
var strConvertICC = localize("$$$/JavaScripts/ImageProcessor/Convert=Convert to sRGB");
var strConvertICCHelp = localize("$$$/JavaScripts/ImageProcessor/ConvertHelp=Convert the ICC profile to sRGB before saving");
var strCheckboxTrimLayers = localize("$$$/JavaScripts/CompsToFiles/Trim=Trim Layers");
var strCheckboxTrimLayersHelp = localize("$$$/JavaScripts/ImageProcessor/TrimLayersHelp=Trims transparent pixels");
var strAlertNoArtboardsFound = localize("$$$/JavaScripts/LayerCompsToABFiles/Noartbrd=No artboards found in document.");
var strIncludeArtboardName = localize("$$$/JavaScripts/LayerCompsToABFiles/IncludeArtboardName=Include Artboard Name")
var strShowUseArtboard = localize("$$$/JavaScripts/ArtboardsToFiles/ShowUseArtboard=Single Artboard")
var strddUseArtBoard = localize("$$$/locale_specific/JavaScripts/LayerCompsToABFiles/DDUseArtboard=100");
var strLabelUseArtboard = localize("$$$/JavaScripts/LayerCompsToABFiles/UseArtboard=Choose Artboard");
var strArtboardPanelOptions = localize("$$$/JavaScripts/ArtboardsToFiles/Options=Options:")
var strAlertComplete = localize("$$$/JavaScripts/ArtboardsToFiles/AlertComplete=Alert on completion")
var strOpenLocation = localize("$$$/JavaScripts/ArtboardsToFiles/OpenLocation=Open destination")
// the drop down list indexes for file type
var bmpIndex = 0;
var jpegIndex = 1;
var pdfIndex = 2;
var psdIndex = 3;
var targaIndex = 4;
var tiffIndex = 5;
var png8Index = 6;
var png24Index = 7;
// the drop down list indexes for tiff compression
var compNoneIndex = 0;
var compLZWIndex = 1;
var compZIPIndex = 2;
var compJPEGIndex = 3;
// ok and cancel button
var runButtonID = 1;
var cancelButtonID = 2;
// */
///////////////////////////////////////////////////////////////////////////////
// Dispatch
///////////////////////////////////////////////////////////////////////////////
app.activeDocument.suspendHistory("Script > Layercomps & Artboards to Files", 'main()');
///////////////////////////////////////////////////////////////////////////////
// Functions
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Function: main
// Usage: the core routine for this script
// Input: <none>
// Return: <none>
///////////////////////////////////////////////////////////////////////////////
function main() {
if (app.documents.length <= 0) {
if (DialogModes.NO != app.playbackDisplayDialogs) {
alert(strAlertDocumentMustBeOpened);
}
return "cancel"; // quit, returning "cancel" (dont localize) makes the actions palette not record our script
}
// Check selected Artboards
// var origDoc = app.activeDocument
//var sel_indxs = getSelectedLayersAMIdx(origDoc)
// check to see if selected layers are artboards have artboardID.
// var abArSelected = getArtBoards(sel_indxs)
// Check if Artboards are available
var abAr = getABLayerInfo().reverse();
var artbrdCount = abAr.length;
// if (artbrdCount == 0) {
// alert(strAlertNoArtboardsFound)
// // alert("No artboard{'s) available, this script needs both a layercomp and artboard.")
// return "cancel";
// }
if (artbrdCount === 0) {
var artboardAvail = false
} else {
var artboardAvail = true
}
// Check if Artboards are available
// var abAr = getABLayerInfo().reverse();
var artbrdCount = abAr.length;
// Check if we can use Layercomps
var docLayerComps = app.activeDocument.layerComps;
var compsCount = docLayerComps.length;
var compS_indx = [];
for (compsIndex = 0; compsIndex < compsCount; compsIndex++) {
var compRef = docLayerComps[compsIndex];
//alert(compRef+" "+compRef.selected)
if (compRef.selected) {
var isSel = true
compS_indx.push(isSelection);
} else {
var isSel = false
}
}
if (compS_indx.length === 0) {
var isSelection = false
} else {
var isSelection = true
}
var exportInfo = new Object();
initExportInfo(exportInfo, isSelection, artboardAvail, false);
// initExportInfo(exportInfo, isSelection);
// look for last used params via Photoshop registry, getCustomOptions will throw if none exist
try {
var d = app.getCustomOptions("d69fc733-75b4-4d5c-ae8a-c6d6f9a8aa32");
descriptorToObject(exportInfo, d, strMessage, postProcessExportInfo);
} catch (e) {
// it"s ok if we don"t have any options, continue with defaults
}
// see if I am getting descriptor parameters
descriptorToObject(exportInfo, app.playbackParameters, strMessage, postProcessExportInfo);
// This method set to init settings
// RUN THE DIALOG! (if dialog setting is on - in case running through recorded action.)
// if (DialogModes.NO != app.playbackDisplayDialogs) {
// // adding anything else here that I do NOT want to be sticky, like the other export options that are not file based.
// initExportInfo(exportInfo, isSelection, artboardAvail, true)
// initFileNameDestination(exportInfo)
// if (DialogModes.ALL == app.playbackDisplayDialogs) {
// if (cancelButtonID == settingDialog(exportInfo)) {
// return "cancel"; // quit, returning "cancel" (dont localize) makes the actions palette not record our script
// }
// }
// }
// initExportInfo without "exportInfo" remembers last settings
// alert(artboardAvail)
initExportInfo(exportInfo, isSelection, artboardAvail, true);
if (DialogModes.ALL == app.playbackDisplayDialogs) {
if (cancelButtonID == settingDialog(exportInfo)) {
return "cancel"; // quit, returning "cancel" (dont localize) makes the actions palette not record our script
}
}
try {
var docName = app.activeDocument.name; // save the app.activeDocument name before duplicate.
var compsName = new String("none");
var compsCount = app.activeDocument.layerComps.length;
if (compsCount < 1) {
if (DialogModes.NO != app.playbackDisplayDialogs) {
alert(strAlertNoLayerCompsFound);
}
return "cancel"; // quit, returning "cancel" (dont localize) makes the actions palette not record our script
} else if (selectedCompsConfigError(app.activeDocument.layerComps, exportInfo)) {
if (DialogModes.NO != app.playbackDisplayDialogs) {
alert(strAlertNoLayerCompsSelected);
}
return "cancel"; // quit, returning "cancel" (dont localize) makes the actions palette not record our script
} else {
// Timer Tom Ruark
// Source: Getter.jsx
var totalTime = new Timer();
app.activeDocument = app.documents[docName];
docRef = app.activeDocument;
var rememberMaximize;
var needMaximize = exportInfo.psdMaxComp ? QueryStateType.ALWAYS : QueryStateType.NEVER;
if (exportInfo.fileType == psdIndex && app.preferences.maximizeCompatibility != needMaximize) {
rememberMaximize = app.preferences.maximizeCompatibility;
app.preferences.maximizeCompatibility = needMaximize;
}
// Fix for single artboard usage
if (exportInfo.artboardShow && (exportInfo.singleArtboard == "0")) {
alert("No artboard selected!" + "\n" + "Select one from the dropdown menu");
main()// return "cancel"; // quit, returning "cancel" (dont localize) makes the actions palette not record our script
}
// alert((exportInfo.selectionOnly && !compRef.selected)+" selected only")
// if ((!exportInfo.useLayerComp == "0") && (!exportInfo.useLayerComp == "1")) {
// alert(exportInfo.useLayerComp.value)
// alert(exportInfo.useLayerComp)
// To fullscreen to speeds > ui doesnt need to be updated
app.runMenuItem(stringIDToTypeID('screenModeFullScreen'));
if ((exportInfo.useLayerComp == "0") || (exportInfo.useLayerComp == "1")) {
var nameCountObj = countCompsNames(docRef.layerComps);
for (compsIndex = 0; compsIndex < compsCount; compsIndex++) {
var compRef = docRef.layerComps[compsIndex];
if (exportInfo.selectionOnly && !compRef.selected) continue; // selected only
compRef.apply();
exportComps(compsIndex, exportInfo, compRef, nameCountObj)
}
} else {
compsIndex = exportInfo.useLayerComp;
var nameCountObj = countCompsNames(docRef.layerComps);
if (exportInfo.useLayerComp == "1") {
var compRef = docRef.layerComps[exportInfo.useLayerComp + 2];
} else {
var compRef = docRef.layerComps[exportInfo.useLayerComp - 2];
}
compRef.apply();
exportComps(compsIndex, exportInfo, compRef, nameCountObj)
}
var d = objectToDescriptor(exportInfo, strMessage, preProcessExportInfo);
app.putCustomOptions("d69fc733-75b4-4d5c-ae8a-c6d6f9a8aa32", d);
var dd = objectToDescriptor(exportInfo, strMessage, preProcessExportInfo);
app.playbackParameters = dd;
if (rememberMaximize != undefined) {
app.preferences.maximizeCompatibility = rememberMaximize;
}
if (DialogModes.ALL == app.playbackDisplayDialogs) {
// alert("Script Time: " + totalTime.getElapsed())
if (exportInfo.openLoc){
// open(exportInfo.destination)
var fold = Folder(exportInfo.destination);
fold.execute()
// alert(fold)
// alert(typeof fold)
// Folder.encode(exportInfo.destination)
// Folder.open();
// folder.execute(exportInfo.destination)
// Folder(exportInfo.destination)
// var folder = Folder(Folder.desktop.toString()); // your folder here
// var cmd = ($.os.indexOf("Win") != -1) ? "explorer " + Folder.decode(folder.fsName) : "open \"" + Folder.decode(folder.fsName) + "\"";
// #target photoshop
// var cmd = 'file://'+exportInfo.destination+'\'';
// system.callSystem(cmd);
}
if (exportInfo.alertComplete){
alert(strTitle + strAlertWasSuccessful + "\n" + exportInfo.destination);
}
}
app.playbackDisplayDialogs = DialogModes.ALL;
}
} catch (e) {
if (DialogModes.NO != app.playbackDisplayDialogs) {
alert(e);
}
return "cancel"; // quit, returning "cancel" (dont localize) makes the actions palette not record our script
}
app.runMenuItem(stringIDToTypeID('screenModeStandard'));
}
///////////////////////////////////////////////////////////////////////////////
// Function: settingDialog
// Usage: pop the ui and get user settings
// Input: exportInfo object containing our parameters
// Return: on ok, the dialog info is set to the exportInfo object
///////////////////////////////////////////////////////////////////////////////
function settingDialog(exportInfo) {
var docName = app.activeDocument.name;
app.activeDocument = app.documents[docName];
docRef = app.activeDocument;
var dlgMain = new Window("dialog", strTitle);
// match our dialog background color to the host application
var brush = dlgMain.graphics.newBrush(dlgMain.graphics.BrushType.THEME_COLOR, "appDialogBackground");
dlgMain.graphics.backgroundColor = brush;
dlgMain.graphics.disabledBackgroundColor = brush;
dlgMain.orientation = "column";
dlgMain.alignChildren = "left";
// -- two groups, one for left and one for right ok, cancel
dlgMain.grpTop = dlgMain.add("group");
dlgMain.grpTop.orientation = "row";
dlgMain.grpTop.alignChildren = "top";
dlgMain.grpTop.alignment = "fill";
// dlgMain.grpTop.spacing = 5;
// dlgMain.grpTop.margins = 5;
// -- group top left
dlgMain.grpTopLeft = dlgMain.grpTop.add("group");
dlgMain.grpTopLeft.orientation = "column";
dlgMain.grpTopLeft.alignChildren = "left";
dlgMain.grpTopLeft.alignment = "fill";
// dlgMain.grpTopLeft.spacing = 10;
// dlgMain.grpTopLeft.margins = 5;
// Panel 1
dlgMain.pnlFiles = dlgMain.grpTopLeft.add("panel", undefined, "Filename & Destination");
dlgMain.pnlFiles.orientation = "column";
dlgMain.pnlFiles.alignChildren = "left";
dlgMain.pnlFiles.alignment = "fill";
// dlgMain.pnlFiles.spacing = 15;
// dlgMain.pnlFiles.margins = 15;
// -- the first line in the dialog
dlgMain.grpFirstLine = dlgMain.pnlFiles.add("group");
dlgMain.grpFirstLine.orientation = "row";
dlgMain.grpFirstLine.alignChildren = "center";
// dlgMain.grpFirstLine.spacing = 0;
// dlgMain.grpFirstLine.margins = 0;
// -- top of the dialog, first line
dlgMain.grpFirstLine.add("statictext", undefined, strLabelDestination);
// -- the second line in the dialog
dlgMain.grpSecondLine = dlgMain.pnlFiles.add("group");
dlgMain.grpSecondLine.orientation = "row";
dlgMain.grpSecondLine.alignChildren = "center";
dlgMain.etDestination = dlgMain.grpSecondLine.add("edittext", undefined, exportInfo.destination.toString());
dlgMain.etDestination.preferredSize = [350, 20];
// dlgMain.etDestination.preferredSize.width = StrToIntWithDefault(stretDestination, 250);
dlgMain.btnBrowse = dlgMain.grpSecondLine.add("button", undefined, strButtonBrowse);
dlgMain.btnBrowse.preferredSize = [50, 25];
dlgMain.btnBrowse.onClick = function() {
var defaultFolder = dlgMain.etDestination.text;
var testFolder = new Folder(dlgMain.etDestination.text);
if (!testFolder.exists) defaultFolder = "~";
var selFolder = Folder.selectDialog(strTitleSelectDestination, defaultFolder);
if (selFolder != null) {
dlgMain.etDestination.text = selFolder.fsName;
}
dlgMain.defaultElement.active = true;
}
// -- the third line in the dialog
dlgMain.grpThirdLine = dlgMain.pnlFiles.add("group");
dlgMain.grpThirdLine.orientation = "row";
dlgMain.grpThirdLine.alignChildren = "center";
dlgMain.pnlFiles.add("statictext", undefined, strLabelFileNamePrefix);
// -- the fourth line in the dialog
// dlgMain.etFileNamePrefix = dlgMain.grpTopLeft.add("edittext", undefined, exportInfo.fileNamePrefix.toString());
// dlgMain.etFileNamePrefix.alignment = "fill";
// dlgMain.etFileNamePrefix.preferredSize.width = StrToIntWithDefault( stretDestination, 160 );
dlgMain.grFileNamePrefixGr = dlgMain.pnlFiles.add("group");
dlgMain.grFileNamePrefixGr.orientation = "row";
// dlgMain.grFileNamePrefixGr.spacing = 5;
// dlgMain.grFileNamePrefixGr.margins = 0;
dlgMain.etFileNamePrefix = dlgMain.grFileNamePrefixGr.add("edittext", undefined, exportInfo.fileNamePrefix.toString());
dlgMain.etFileNamePrefix.preferredSize = [350, 20];
dlgMain.cbFileNamePrefixIndex = dlgMain.grFileNamePrefixGr.add("checkbox", undefined, "Index");
dlgMain.cbFileNamePrefixIndex.alignment = "right";
dlgMain.cbFileNamePrefixIndex.value = exportInfo.prefixIndex;
dlgMain.pnlFiles.add("statictext", undefined, strLabelFileNameSuffix);
dlgMain.grFileNameSuffixGr = dlgMain.pnlFiles.add("group");
dlgMain.grFileNameSuffixGr.orientation = "row";
// dlgMain.grFileNameSuffixGr.spacing = 5;
// dlgMain.grFileNameSuffixGr.margins = 0;
dlgMain.etFileNameSuffix = dlgMain.grFileNameSuffixGr.add("edittext", undefined, exportInfo.fileNameSuffix.toString());
dlgMain.etFileNameSuffix.preferredSize = [350, 20];
// Panel 2 Options
dlgMain.pnlOptions = dlgMain.grpTopLeft.add("panel", undefined, "Options");
dlgMain.pnlOptions.orientation = "column";
dlgMain.pnlOptions.alignChildren = "left";
dlgMain.pnlOptions.alignment = "fill";
// -- the fifth line in the dialog
dlgMain.grLayComps = dlgMain.pnlOptions.add("group");
dlgMain.grLayComps.orientation = "row";
dlgMain.cbSelection = dlgMain.grLayComps.add("checkbox", undefined, strCheckboxSelectionOnly);
dlgMain.cbSelection.value = exportInfo.selectionOnly;
dlgMain.cbSelection.enabled = exportInfo.selectionOnly;
// if (!dlgMain.ddUseComp.items["0"]) dlgMain.cbSelection.enabled = true
dlgMain.cbSelection.helpTip = strcbSelectionHelp;
// dlgMain.pnlUseArtboard.pnlABoptions.add("statictext", undefined, strLabelUseArtboard);
dlgMain.ddUseComp = dlgMain.grLayComps.add("dropdownlist");
dlgMain.ddUseComp.preferredSize.width = StrToIntWithDefault(strddUseArtBoard, 120);
dlgMain.ddUseComp.alignment = "right";
dlgMain.ddUseComp.helpTip = strddUseComp;
// var UseComp = countCompsNames(docRef.layerComps);
var UseCompCount = docRef.layerComps.length;
dlgMain.ddUseComp.add("item", "All");
dlgMain.ddUseComp.add("item", "Selected");
for (UseCompIndex = 0; UseCompIndex < UseCompCount; UseCompIndex++) {
dlgMain.ddUseComp.add("item", docRef.layerComps[UseCompIndex].name);
}
// Set menu too default
if (!exportInfo.selectionOnly) dlgMain.ddUseComp.items["0"].selected = true;
if (exportInfo.selectionOnly) dlgMain.ddUseComp.items["1"].selected = true;
dlgMain.ddUseComp.onChange = function() {
if ((dlgMain.cbSelection.value) && (dlgMain.ddUseComp.items["0"].selected)) {
dlgMain.cbSelection.value = false;
}
if ((!dlgMain.cbSelection.value) && (dlgMain.ddUseComp.items["1"].selected)) {
dlgMain.cbSelection.value = true;
} else {
dlgMain.cbSelection.value = false;
}
}
dlgMain.cbLyrCompName = dlgMain.pnlOptions.add("checkbox", undefined, strCheckboxAddLyrCompName);
dlgMain.cbLyrCompName.value = exportInfo.addLyrCompName;
dlgMain.cbComment = dlgMain.pnlOptions.add("checkbox", undefined, strCheckboxAddCompComment);
dlgMain.cbComment.value = exportInfo.addCompComment;
// - Added ArtBoard names optional
dlgMain.cbIncludeArtboardName = dlgMain.pnlOptions.add("checkbox", undefined, strIncludeArtboardName);
dlgMain.cbIncludeArtboardName.value = exportInfo.inclArtboardName;
dlgMain.cbIncludeArtboardName.enabled = exportInfo.artboardsEnab;
// - Picker custom Artboard
// -- now a dropdown list
// enable checkbox functionality
dlgMain.grArtboards = dlgMain.pnlOptions.add("group");
dlgMain.grArtboards.orientation = "row";
dlgMain.cbArtboardShow = dlgMain.grArtboards.add("checkbox", undefined, strShowUseArtboard);
dlgMain.cbArtboardShow.value = exportInfo.artboardShow;
dlgMain.cbArtboardShow.enabled = exportInfo.artboardsEnab;
// dlgMain.pnlUseArtboard = dlgMain.pnlOptions.add("group");
// dlgMain.pnlUseArtboard.alignment = "left";
// dlgMain.pnlUseArtboard.pnlABoptions = dlgMain.grpTopLeft.add("panel", undefined, strLabelUseArtboard);
dlgMain.pnlABoptions = dlgMain.grArtboards.add("group");
// dlgMain.pnlUseArtboard.pnlABoptions.spacing = 1;
// dlgMain.pnlUseArtboard.pnlABoptions.margins = 1;
dlgMain.pnlABoptions.alignment = "left";
dlgMain.pnlABoptions.add("statictext", undefined, strLabelUseArtboard);
dlgMain.pnlABoptions.ddUseArtboard = dlgMain.pnlABoptions.add("dropdownlist");
dlgMain.pnlABoptions.ddUseArtboard.preferredSize.width = StrToIntWithDefault(strddUseArtBoard, 120);
dlgMain.pnlABoptions.ddUseArtboard.alignment = "left";
var UseabAr = getABLayerInfo().reverse();
var UseartbrdCount = UseabAr.length;
// UseartbrdCount += 1; //add 1 to compensentate None in menu
dlgMain.pnlABoptions.ddUseArtboard.add("item", "None");
for (UseartbrdIndex = 0; UseartbrdIndex < UseartbrdCount; UseartbrdIndex++) {
dlgMain.pnlABoptions.ddUseArtboard.add("item", UseabAr[UseartbrdIndex].name);
}
// -- now the options panel that changes
// dlgMain.pnlUseArtboard.pnlABoptions = dlgMain.pnlUseArtboard.add("panel", undefined, strArtboardPanelOptions)
// dlgMain.pnlUseArtboard.pnlABoptions.alignment = "fill"
dlgMain.cbArtboardShow.onClick = function() {
if (dlgMain.cbArtboardShow.value) {
dlgMain.pnlABoptions.show();
populateOptions(dlgMain.pnlABoptions.ddUseArtboard.selection.index);
}
if (!dlgMain.cbArtboardShow.value) {
dlgMain.pnlABoptions.hide();
}
}
// Also hide artboard options
if (!dlgMain.cbArtboardShow.value) dlgMain.pnlABoptions.hide();
// Set menu too default
dlgMain.pnlABoptions.ddUseArtboard.items["0"].selected = true;
// dlgMain.pnlUseArtboard.pnlABoptions.ddUseArtboard.items[chosenArtboard].selected = true;
// -- the sixth line is the panel
dlgMain.pnlFileType = dlgMain.grpTopLeft.add("panel", undefined, strLabelFileType);
dlgMain.pnlFileType.alignment = "fill";
dlgMain.pnlFileType.alignChildren = ["top", "left"];
// -- now a dropdown list
dlgMain.ddFileType = dlgMain.pnlFileType.add("dropdownlist");
dlgMain.ddFileType.preferredSize.width = StrToIntWithDefault(strddFileType, 100);
dlgMain.ddFileType.alignment = "left";
dlgMain.ddFileType.add("item", "BMP");
dlgMain.ddFileType.add("item", "JPEG");
dlgMain.ddFileType.add("item", "PDF");
dlgMain.ddFileType.add("item", "PSD");
dlgMain.ddFileType.add("item", "Targa");
dlgMain.ddFileType.add("item", "TIFF");
dlgMain.ddFileType.add("item", "PNG-8");
dlgMain.ddFileType.add("item", "PNG-24");
dlgMain.ddFileType.onChange = function() {
hideAllFileTypePanel(dlgMain);
switch (this.selection.index) {
case bmpIndex:
dlgMain.pnlFileType.pnlOptions.text = strBMPOptions;
dlgMain.pnlFileType.pnlOptions.grpBMPOptions.show();
break;
case jpegIndex:
dlgMain.pnlFileType.pnlOptions.text = strJPEGOptions;
dlgMain.pnlFileType.pnlOptions.grpJPEGOptions.show();
break;
case tiffIndex:
dlgMain.pnlFileType.pnlOptions.text = strTIFFOptions;
dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.show();
break;
case pdfIndex:
dlgMain.pnlFileType.pnlOptions.text = strPDFOptions;
dlgMain.pnlFileType.pnlOptions.grpPDFOptions.show();
break;
case targaIndex:
dlgMain.pnlFileType.pnlOptions.text = strTargaOptions;
dlgMain.pnlFileType.pnlOptions.grpTargaOptions.show();
break;
case png8Index:
dlgMain.pnlFileType.pnlOptions.text = strPNG8Options;
dlgMain.pnlFileType.pnlOptions.grpPNG8Options.show();
break;
case png24Index:
dlgMain.pnlFileType.pnlOptions.text = strPNG24Options;
dlgMain.pnlFileType.pnlOptions.grpPNG24Options.show();
break;
case psdIndex:
default:
dlgMain.pnlFileType.pnlOptions.text = strPSDOptions;
dlgMain.pnlFileType.pnlOptions.grpPSDOptions.show();
break;
}
}
dlgMain.ddFileType.items[exportInfo.fileType].selected = true;
// -- now after all the radio buttons
var grICCGr = dlgMain.pnlFileType.add("group");
grICCGr.orientation = "row";
grICCGr.alignChildren = ["left", "top"];
// dlgMain.grICCGr.orientation = "column";
// dlgMain.grICCGr.alignment = "left";
// grICCGr.spacing = 10;
// grICCGr.margins = 5;
var grICC = grICCGr.add("group");
grICC.orientation = "column";
grICC.alignChildren = ["left", "top"];
var cbIcc = grICC.add("checkbox", undefined, strCheckboxIncludeICCProfile);
cbIcc.value = exportInfo.icc;
strICCprofile = grICC.add("statictext", undefined);
try {
strICCprofile.text = app.activeDocument.colorProfileName;
}
catch(e){
// alert(e)
alert("Missing document Color Profile! \nScript will continou but export can look different");
}
// dlgMain.cbIcc.alignment = "left";
var cbConvertICC = grICCGr.add("checkbox", undefined, strConvertICC);
cbConvertICC.value = exportInfo.convicc;
// cbConvertICC.alignment = "right";
cbConvertICC.helpTip = strConvertICCHelp;
var cbTrimLayers = grICCGr.add("checkbox", undefined, strCheckboxTrimLayers);
cbTrimLayers.value = exportInfo.convicc;
// cbTrimLayers.alignment = "right";
cbTrimLayers.helpTip = strCheckboxTrimLayersHelp;
// -- now the options panel that changes
dlgMain.pnlFileType.pnlOptions = dlgMain.pnlFileType.add("panel", undefined, "Options");
dlgMain.pnlFileType.pnlOptions.alignment = "fill";
dlgMain.pnlFileType.pnlOptions.orientation = "stack";
dlgMain.pnlFileType.pnlOptions.preferredSize.height = StrToIntWithDefault(strpnlOptions, 100);
// PSD options
dlgMain.pnlFileType.pnlOptions.grpPSDOptions = dlgMain.pnlFileType.pnlOptions.add("group");
dlgMain.pnlFileType.pnlOptions.grpPSDOptions.cbPSDlayers = dlgMain.pnlFileType.pnlOptions.grpPSDOptions.add("checkbox", undefined, strPSDlayers.toString());
dlgMain.pnlFileType.pnlOptions.grpPSDOptions.cbPSDlayers.value = exportInfo.psdLayers;
dlgMain.pnlFileType.pnlOptions.grpPSDOptions.cbMax = dlgMain.pnlFileType.pnlOptions.grpPSDOptions.add("checkbox", undefined, strCheckboxMaximizeCompatibility);
dlgMain.pnlFileType.pnlOptions.grpPSDOptions.cbMax.value = exportInfo.psdMaxComp;
dlgMain.pnlFileType.pnlOptions.grpPSDOptions.visible = (exportInfo.fileType == psdIndex);
// PNG8 options
dlgMain.pnlFileType.pnlOptions.grpPNG8Options = dlgMain.pnlFileType.pnlOptions.add("group");
dlgMain.pnlFileType.pnlOptions.grpPNG8Options.png8Trans = dlgMain.pnlFileType.pnlOptions.grpPNG8Options.add("checkbox", undefined, strCheckboxPNGTransparency.toString());
dlgMain.pnlFileType.pnlOptions.grpPNG8Options.png8Inter = dlgMain.pnlFileType.pnlOptions.grpPNG8Options.add("checkbox", undefined, strCheckboxPNGInterlaced.toString());
dlgMain.pnlFileType.pnlOptions.grpPNG8Options.png8Trans.value = exportInfo.png8Transparency;
dlgMain.pnlFileType.pnlOptions.grpPNG8Options.png8Inter.value = exportInfo.png8Interlaced;
dlgMain.pnlFileType.pnlOptions.grpPNG8Options.visible = (exportInfo.fileType == png8Index);
// PNG24 options
dlgMain.pnlFileType.pnlOptions.grpPNG24Options = dlgMain.pnlFileType.pnlOptions.add("group");
dlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Trans = dlgMain.pnlFileType.pnlOptions.grpPNG24Options.add("checkbox", undefined, strCheckboxPNGTransparency.toString());
dlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Inter = dlgMain.pnlFileType.pnlOptions.grpPNG24Options.add("checkbox", undefined, strCheckboxPNGInterlaced.toString());
dlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Trans.value = exportInfo.png24Transparency;
dlgMain.pnlFileType.pnlOptions.grpPNG24Options.png24Inter.value = exportInfo.png24Interlaced;
dlgMain.pnlFileType.pnlOptions.grpPNG24Options.visible = (exportInfo.fileType == png24Index);
// JPEG options
dlgMain.pnlFileType.pnlOptions.grpJPEGOptions = dlgMain.pnlFileType.pnlOptions.add("group");
dlgMain.pnlFileType.pnlOptions.grpJPEGOptions.add("statictext", undefined, strLabelQuality);
dlgMain.pnlFileType.pnlOptions.grpJPEGOptions.etQuality = dlgMain.pnlFileType.pnlOptions.grpJPEGOptions.add("edittext", undefined, exportInfo.jpegQuality.toString());
dlgMain.pnlFileType.pnlOptions.grpJPEGOptions.etQuality.preferredSize.width = StrToIntWithDefault(stretQuality, 30);
dlgMain.pnlFileType.pnlOptions.grpJPEGOptions.visible = (exportInfo.fileType == jpegIndex);
// TIFF options
dlgMain.pnlFileType.pnlOptions.grpTIFFOptions = dlgMain.pnlFileType.pnlOptions.add("group");
dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.orientation = "column";
dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.visible = (exportInfo.fileType == tiffIndex);
dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.rowtiff = dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.add("group");
dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.rowtiff.orientation = "row";
dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.cbTIFFlayers = dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.rowtiff.add("checkbox", undefined, strTIFFlayers.toString());
dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.cbTIFFlayers.value = exportInfo.tiffLayers;
dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.tiffTrans = dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.rowtiff.add("checkbox", undefined, strCheckboxTIFFTransparency.toString());
dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.tiffTrans.value = exportInfo.tiffTransparency;
dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpCompression = dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.add("group");
dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpCompression.alignment = "left";
dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpCompression.add("statictext", undefined, strLabelImageCompression);
dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpCompression.ddCompression = dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpCompression.add("dropdownlist");
dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpCompression.ddCompression.add("item", strNone);
dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpCompression.ddCompression.add("item", "LZW");
dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpCompression.ddCompression.add("item", "ZIP");
dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpCompression.ddCompression.add("item", "JPEG");
dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpCompression.ddCompression.onChange = function() {
if (this.selection.index == compJPEGIndex) {
dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpQuality.stQuality.enabled = true;
dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpQuality.etQuality.enabled = true;
} else {
dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpQuality.stQuality.enabled = false;
dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpQuality.etQuality.enabled = false;
}
}
dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpQuality = dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.add("group");
dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpQuality.alignment = "left";
dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpQuality.stQuality = dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpQuality.add("statictext", undefined, strLabelQuality);
dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpQuality.etQuality = dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpQuality.add("edittext", undefined, exportInfo.tiffJpegQuality.toString());
dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpQuality.etQuality.preferredSize.width = StrToIntWithDefault(stretQuality, 30);
dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpQuality.etQuality.graphics.disabledBackgroundColor = brush;
var index;
switch (exportInfo.tiffCompression) {
case TIFFEncoding.NONE:
index = compNoneIndex;
break;
case TIFFEncoding.TIFFLZW:
index = compLZWIndex;
break;
case TIFFEncoding.TIFFZIP:
index = compZIPIndex;
break;
case TIFFEncoding.JPEG:
index = compJPEGIndex;
break;
default:
index = compNoneIndex;
break;
}
dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpCompression.ddCompression.items[index].selected = true;
if (TIFFEncoding.JPEG != exportInfo.tiffCompression) { // if not JPEG
dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpQuality.stQuality.enabled = false;
dlgMain.pnlFileType.pnlOptions.grpTIFFOptions.grpQuality.etQuality.enabled = false;
}
// PDF options
dlgMain.pnlFileType.pnlOptions.grpPDFOptions = dlgMain.pnlFileType.pnlOptions.add("group");
dlgMain.pnlFileType.pnlOptions.grpPDFOptions.orientation = "column";
dlgMain.pnlFileType.pnlOptions.grpPDFOptions.visible = (exportInfo.fileType == pdfIndex);
dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpCompression = dlgMain.pnlFileType.pnlOptions.grpPDFOptions.add("group");
dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpCompression.alignment = "left";
dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpCompression.add("statictext", undefined, strLabelEncoding);
dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpCompression.rbZip = dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpCompression.add("radiobutton", undefined, "ZIP");
dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpCompression.rbZip.onClick = function() {
dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpQuality.stQuality.enabled = false;
dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpQuality.etQuality.enabled = false;
}
dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpCompression.rbJpeg = dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpCompression.add("radiobutton", undefined, "JPEG");
dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpCompression.rbJpeg.onClick = function() {
dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpQuality.stQuality.enabled = true;
dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpQuality.etQuality.enabled = true;
}
dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpQuality = dlgMain.pnlFileType.pnlOptions.grpPDFOptions.add("group");
dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpQuality.alignment = "left";
dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpQuality.stQuality = dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpQuality.add("statictext", undefined, strLabelQuality);
dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpQuality.etQuality = dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpQuality.add("edittext", undefined, exportInfo.pdfJpegQuality.toString());
dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpQuality.etQuality.preferredSize.width = StrToIntWithDefault(stretQuality, 30);
dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpQuality.etQuality.graphics.disabledBackgroundColor = brush;
switch (exportInfo.pdfEncoding) {
case PDFEncoding.PDFZIP:
dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpCompression.rbZip.value = true;
break;
case PDFEncoding.JPEG:
default:
dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpCompression.rbJpeg.value = true;
break;
}
if (PDFEncoding.JPEG != exportInfo.pdfEncoding) {
dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpQuality.stQuality.enabled = false;
dlgMain.pnlFileType.pnlOptions.grpPDFOptions.grpQuality.etQuality.enabled = false;
}
dlgMain.pnlFileType.pnlOptions.grpPDFOptions.cbPDFlayers = dlgMain.pnlFileType.pnlOptions.grpPDFOptions.add("checkbox", undefined, strPDFlayers.toString());
dlgMain.pnlFileType.pnlOptions.grpPDFOptions.cbPDFlayers.value = exportInfo.pdfLayers;
// Targa options
dlgMain.pnlFileType.pnlOptions.grpTargaOptions = dlgMain.pnlFileType.pnlOptions.add("group");
dlgMain.pnlFileType.pnlOptions.grpTargaOptions.add("statictext", undefined, strLabelDepth);
dlgMain.pnlFileType.pnlOptions.grpTargaOptions.visible = (exportInfo.fileType == targaIndex);
dlgMain.pnlFileType.pnlOptions.grpTargaOptions.rb16bit = dlgMain.pnlFileType.pnlOptions.grpTargaOptions.add("radiobutton", undefined, strRadiobutton16bit);
dlgMain.pnlFileType.pnlOptions.grpTargaOptions.rb24bit = dlgMain.pnlFileType.pnlOptions.grpTargaOptions.add("radiobutton", undefined, strRadiobutton24bit);
dlgMain.pnlFileType.pnlOptions.grpTargaOptions.rb32bit = dlgMain.pnlFileType.pnlOptions.grpTargaOptions.add("radiobutton", undefined, strRadiobutton32bit);
switch (exportInfo.targaDepth) {
case TargaBitsPerPixels.SIXTEEN:
dlgMain.pnlFileType.pnlOptions.grpTargaOptions.rb16bit.value = true;
break;
case TargaBitsPerPixels.TWENTYFOUR:
dlgMain.pnlFileType.pnlOptions.grpTargaOptions.rb24bit.value = true;
break;
case TargaBitsPerPixels.THIRTYTWO:
dlgMain.pnlFileType.pnlOptions.grpTargaOptions.rb32bit.value = true;
break;
default:
dlgMain.pnlFileType.pnlOptions.grpTargaOptions.rb24bit.value = true;
break;
}
// BMP options
dlgMain.pnlFileType.pnlOptions.grpBMPOptions = dlgMain.pnlFileType.pnlOptions.add("group");
dlgMain.pnlFileType.pnlOptions.grpBMPOptions.add("statictext", undefined, strLabelDepth);
dlgMain.pnlFileType.pnlOptions.grpBMPOptions.visible = (exportInfo.fileType == bmpIndex);
dlgMain.pnlFileType.pnlOptions.grpBMPOptions.rb16bit = dlgMain.pnlFileType.pnlOptions.grpBMPOptions.add("radiobutton", undefined, strRadiobutton16bit);
dlgMain.pnlFileType.pnlOptions.grpBMPOptions.rb24bit = dlgMain.pnlFileType.pnlOptions.grpBMPOptions.add("radiobutton", undefined, strRadiobutton24bit);
dlgMain.pnlFileType.pnlOptions.grpBMPOptions.rb32bit = dlgMain.pnlFileType.pnlOptions.grpBMPOptions.add("radiobutton", undefined, strRadiobutton32bit);
switch (exportInfo.bmpDepth) {
case BMPDepthType.SIXTEEN:
dlgMain.pnlFileType.pnlOptions.grpBMPOptions.rb16bit.value = true;
break;
case BMPDepthType.TWENTYFOUR:
dlgMain.pnlFileType.pnlOptions.grpBMPOptions.rb24bit.value = true;
break;
case BMPDepthType.THIRTYTWO:
dlgMain.pnlFileType.pnlOptions.grpBMPOptions.rb32bit.value = true;
break;
default:
dlgMain.pnlFileType.pnlOptions.grpBMPOptions.rb24bit.value = true;
break;
}
// the right side of the dialog, the ok and cancel buttons
dlgMain.grpTopRight = dlgMain.grpTop.add("group");
dlgMain.grpTopRight.orientation = "column";
dlgMain.grpTopRight.alignChildren = "fill";
dlgMain.btnRun = dlgMain.grpTopRight.add("button", undefined, strButtonRun);