Guest User

Untitled

a guest
May 4th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #target photoshop
  2.  
  3. app.bringToFront();
  4.  
  5. var ui = //dialog resource object
  6.     "dialog { \
  7.         alignChildren: 'fill', \
  8.         pFiles: Panel { \
  9.             orientation: 'column', alignChildren:'left', \
  10.             text: 'Source/Destination', \
  11.             g1: Group { \
  12.                 orientation: 'row', alignChildren: 'left', \
  13.                 display: StaticText { text:'Source Images Files or Folder:  ' }, \
  14.                 src: DropDownList {alignment: 'left'}, \
  15.                 choose: Button { text: 'Choose' } \
  16.                 }, \
  17.             g2:Group { \
  18.                 orientation: 'row', alignChildren: 'left', \
  19.                 display: StaticText { text:'Output Folder:  ' }, \
  20.                 choose: Button { text: 'Choose' } \
  21.             }, \
  22.         }, \
  23.         pResize: Panel { \
  24.             orientation: 'column', alignChildren: 'left', \
  25.             text: 'Resize Options', \
  26.             g1: Group { \
  27.                 orientation: 'column', alignChildren: 'left', \
  28.                 axis: RadioButton { text: 'Resize by Longest Axis' }, \
  29.                 resize: RadioButton { text: 'Resize Both Axes' }, \
  30.             }, \
  31.             g2: Group { \
  32.                 orientation: 'row', alignChildren: 'left', \
  33.                 display: StaticText { text: 'Enter Value for Longest Axis: ' }, \
  34.                 axisTxt: EditText { bounds: [ 0, 0, 60, 21 ] }, \
  35.             }, \
  36.             g3: Group { \
  37.                 orientation: 'row', alignChildren: 'left', \
  38.                 displayX: StaticText { text: 'Width: ' }, \
  39.                 resizeX: EditText { bounds: [ 0, 0, 60, 21 ] }, \
  40.                 displayY: StaticText { text: 'Height: ' }, \
  41.                 resizeY: EditText { bounds: [ 0, 0, 60, 21 ] }, \
  42.             }, \
  43.             g4: Group { \
  44.                 orientation: 'row', alignChildren: 'left', \
  45.                 displayCB: Checkbox{ text: 'Resize Canvas' }, \
  46.             }, \
  47.             g5: Group { \
  48.                 orientation: 'row', alignChildren: 'left', \
  49.                 displayX: StaticText { text: 'Width: ' }, \
  50.                 resizeX: EditText { bounds: [ 0, 0, 60, 21 ] }, \
  51.                 displayY: StaticText { text: 'Height: ' }, \
  52.                 resizeY: EditText { bounds: [ 0, 0, 60, 21 ] }, \
  53.             }, \
  54.         }, \
  55.         pExport: Panel { \
  56.             orientation: 'column', alignChildren: 'left', \
  57.             text: 'Export Options', \
  58.             g1: Group { \
  59.                 orientation: 'column', alignChildren: 'left', \
  60.                 exportPSD: Checkbox{ text: 'Export PSD' }, \
  61.                 exportWeb: Checkbox{ text: 'Export for Web (jpeg)' }, \
  62.                 exportToLayer: Checkbox{ text: 'Export to Layers' }, \
  63.                 exportLayer: Checkbox{ text: 'Export Layers for Web (jpeg)' }, \
  64.             }, \
  65.         }, \
  66.         pForWeb: Panel { \
  67.             orientation: 'column', alignChildren: 'left', \
  68.             text: 'Export for Web Options', \
  69.             g1: Group { \
  70.                 orientation: 'row', alignChildren: 'left', \
  71.                 colorPick: Button { text: 'Matte Color' }, \
  72.                 qualTxt: StaticText{ text: 'Quality: ' }, \
  73.                 qualEntry: EditText { bounds: [ 0, 0, 30, 21 ] }, \
  74.                 qualPer: StaticText{ text: '%' }, \
  75.             }, \
  76.         }, \
  77.         gButtons:Group { \
  78.             orientation: 'row', alignment: 'right', \
  79.             okButn: Button { text:'Ok', properties: {name:'ok'} }, \
  80.             cancelBtn: Button { text:'Cancel', properties: {name:'cancel'} } \
  81.         } \
  82.     }";
  83.  
  84. var win = new Window( ui );
  85.  
  86. var srcDrop = win.pFiles.g1.src;
  87. var srcBtn = win.pFiles.g1.choose;
  88. var destBtn = win.pFiles.g2.choose;
  89. var axisRBtn = win.pResize.g1.axis;
  90. var resizeRBtn = win.pResize.g1.resize;
  91. var axisTxt = win.pResize.g2;
  92. var resizeTxt = win.pResize.g3;
  93. var canvasCB = win.pResize.g4.displayCB;
  94. var canvasTxt = win.pResize.g5;
  95. var colorBtn = win.pForWeb.g1.colorPick;
  96.  
  97. srcBtn.visible = false;
  98. axisTxt.visible = false;
  99. resizeTxt.visible = false;
  100. canvasTxt.visible = false;
  101.  
  102. srcDrop.add( 'item', 'File' );
  103. srcDrop.add( 'item', 'Folder' );
  104. srcDrop.onChange = function() {
  105.     var curr = this.selection;
  106.     //$.write( curr );
  107.     if( curr != null && srcBtn.visible == false ){
  108.         srcBtn.visible = true;
  109.     }
  110. }
  111.  
  112. axisRBtn.onClick = function() {
  113.     axisTxt.visible = true;
  114.     resizeTxt.visible = false;
  115.     //var testTxt = axisTxt.add( 'statictext', [0, 0, 80, 21], 'test' );
  116. }
  117.  
  118. resizeRBtn.onClick = function() {
  119.     axisTxt.visible = false;
  120.     resizeTxt.visible = true;
  121. }
  122.  
  123. canvasCB.onClick = function(){
  124.     canvasTxt.visible = this.value;
  125. }
  126.  
  127. colorBtn.onClick = function(){
  128.         var mycolor = $.colorPicker (0xffffff);
  129.         $.write( mycolor.toString(16) );
  130. }
  131.  
  132. //$.write("ugh");
  133.  
  134. win.show();
Advertisement
Add Comment
Please, Sign In to add comment