2 Replies Latest reply on Sep 13, 2011 8:50 PM by praveen mds

    script needs to be fixed

    praveen mds Level 1

      Hello Guys,

       

      This script needs fixup. it cant create a folder in the specified path.

       

      #target photoshop
      var dialogBox = 
          "dialog { orientation: 'column', alignChildren: 'center', \
              info: Group { orientation: 'column', alignChildren: 'center', \
              templateType: Group { orientation: 'column', alignChildren: 'center', margins: 0, \
                  rbtn1:  RadioButton {  text: 'GRAYSCALE', assignmet: 'left'}, \
                  rbtn2:  RadioButton {  text: 'CMYK', assignmet: 'left'}, \
              }, \
          }, \
                  buttons: Group { orientation: 'row', \
                  ok: Button { text: 'OK', properties:{name:'ok'} }, \
                  cancel: Button { text: 'Cancel', properties:{name:'cancel'} }, \
                  } \
      }";win = new Window (dialogBox);
      win.text = "Techset_Graphics";
      win.buttons.ok.onClick = function()
      {
       if(win.info.templateType.rbtn1.value)
       {
          convert_gray()
          }
       else if(win.info.templateType.rbtn2.value)
       {
       convert_CMYK()
       }
          var idoc = app.activeDocument
          var TiffOptions = new TiffSaveOptions()
          TiffOptions.imageCompression = TIFFEncoding.TIFFLZW;
          TiffOptions.embedColorProfile = false;
          var newfolder = new Folder(idoc.path+'/print');
          idoc.saveAs(new File(idoc.path+'/print/'+idoc.name), TiffOptions, true, Extension.LOWERCASE)
       win.close(0);
      }
      win.buttons.cancel.onClick = function()
      {
       win.close(0);
      }
      win.center(); 
      win.show();
      function convert_gray(){
      var idCnvM = charIDToTypeID( "CnvM" );
          var desc222 = new ActionDescriptor();
          var idT = charIDToTypeID( "T   " );
          var idGrys = charIDToTypeID( "Grys" );
          desc222.putClass( idT, idGrys );
      executeAction( idCnvM, desc222, DialogModes.NO );    
      }
      function convert_CMYK(){
      var idCnvM = charIDToTypeID( "CnvM" );
          var desc224 = new ActionDescriptor();
          var idT = charIDToTypeID( "T   " );
          var idCMYM = charIDToTypeID( "CMYM" );
          desc224.putClass( idT, idCMYM );
      executeAction( idCnvM, desc224, DialogModes.NO );
      }
      


      var newfolder = new Folder(idoc.path+'/print'); Any syntax error with this line?

       

      many thanks,

      Praveen