1 Reply Latest reply on Jul 14, 2009 1:48 AM by robin521

    it's strange that no error but no response with my documents, WHY?!YHW?HYW?

    robin521 Level 1

      Hi Scripter,

       

       

      i have been rewrite my Script according peoples say, Thanks very much for Herbs help, And now there are no errors with it. but sill no response with document,i don't know why? i have been debug it step into(F11), not found any clue,  my aim is setup all element in my documents which composer="$ID/HL Composer J",kerningMethod="$ID/Metrics - Roman Only",appliedLanguage="$ID/Chinese: Simplified",.hyphenation = false, what's wrong with my script, if could , is there are any others way ?

       

      and the screenshot was attached.

       

      Thanks, your help will be appriciated!

       

      the script is following:

       

      //段落スタイルのカーニング、言語、ハイフネーション、単数行の一括設定
      //作成日:2007/07/10
      //version 1.0
      //Tomoki Matsuura

      //アクティブ文書の判定
      if (app.documents.length==0) {  //現在アクティブな文書があるかどうかを判定
      alert("YOU MUST OPEN A DOC FIRST!!");
      //処理を中止
      }
      else {
      //現在の文書を変数に入れる
      myActiveDoc = app.activeDocument;
      //段落スタイル数の取得
      myParaStyleLength = myActiveDoc.paragraphStyles.length;
      //配列の設定
      //myParaStyleComposerArry = new Array(myParaStyleLength); //コンポーザ
      //myParaStylekerningArry =  new Array(myParaStyleLength); //カーニング
      //myParaStyleLangArry =  new Array(myParaStyleLength); //言語
      //myParaStyleHyphenationArry =  new Array(myParaStyleLength); //ハイフネーション
      //ダイアログの定義
      var myDialog = app.dialogs.add({name:"全局替换的段落样式的设定", canCancel:true});
      with(myDialog) {
        with(dialogColumns.add()) {
         with(borderPanels.add()) {
          with(dialogColumns.add()) {
           staticTexts.add({staticLabel:"勾选全局替换的样式:"});
          }
          with(dialogColumns.add()) {
           var myParaStyleComposer = checkboxControls.add({staticLabel:"书写器:Adobe CJK 段落书写器",checkedState:true});
           var myParaStylekerning = checkboxControls.add({staticLabel:"字偶间距调整:原始设定 - 仅罗马字",checkedState:true});
           var myParaStyleLang = checkboxControls.add({staticLabel:"语言:简体中文",checkedState:true});
           var myParaStyleHyphenation = checkboxControls.add({staticLabel:"连字:关",checkedState:true});
          }
         }
        }
      }
      //ダイアログの表示
      if(myDialog.show() == true) {
        //チェックステート
        var myParaStyleComposerCS = myParaStyleComposer.checkedState;
        var myParaStylekerningCS = myParaStylekerning.checkedState;
        var myParaStyleLangCS = myParaStyleLang.checkedState;
        var myParaStyleHyphenationCS = myParaStyleHyphenation.checkedState;
       
        //alert(myParaStyleComposerCS+' '+myParaStylekerningCS+' '+myParaStyleLangCS+' '+myParaStyleHyphenationCS);
        myDialog.destroy();
        //コンポーザの設定
        if(myParaStyleComposerCS==true) {
         var ParaComposer =app.translateKeyString("$ID/HL Composer J");
          for (var i=1; i<myParaStyleLength; i++) {
         
           //myActiveDoc.paragraphStyles[i].composer = ParaC;
           //myActiveDoc.paragraphStyles[i].composer = "Adobe CJK 段落书写器";
           myActiveDoc.paragraphStyles[i].composer = ParaComposer;
             //$.writeln(app.selection[0].composer);
            //$.writeln(app.findKeyStrings (result));

         
         }
        }
        //カーニングの設定
        if(myParaStylekerningCS==true) {
       
        
        var RomanKerning=app.translateKeyString("$ID/Metrics - Roman Only");
         for (var i=1; i<myParaStyleLength; i++) {
       
         
            myActiveDoc.paragraphStyles[i].kerningMethod=RomanKerning;
           
           
         
         }
        }
        //言語の設定
        if(myParaStyleLangCS==true) {
      var ChineseLan=app.translateKeyString("$ID/Chinese: Simplified");
        
         for (var i=1; i<myParaStyleLength; i++) {
          if (i==0) {
           //ルートスタイルなので無視
          }
          else {
          
             myActiveDoc.paragraphStyles[i].appliedLanguage=ChineseLan;
           //$.writeln(app.findKeyStrings("$ID/中文: 简体"))
          }
         }
        }
        //ハイフネーションの設定
        if(myParaStyleHyphenationCS==true) {
         for (var i=1; i<myParaStyleLength; i++) {
          if (i==0) {
           //ルートスタイルなので無視
          }
          else {
        
           myActiveDoc.paragraphStyles[i].hyphenation = false;
          }
         }
        }
      }
      else {
        myDialog.destroy();
      }
      }

       

      Reagrds,

      Robin