5 Replies Latest reply on Jul 17, 2009 12:23 AM by robin521

    It's can not run in CS4, Why?

    robin521

      Hi Scripter,

       

      i have been rewrite my Script according peoples said, Thanks very much for help, And now there are no errors with it. but sill no response with document,i think there still something wrong with it!? After debug it step into(F11), not found any clue(run as normally like other healthy script),  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, it seems like a obvious lie, can any body help me? if could , is there are any others way ?

       

      your help will be appreciated!

      Thanks, here is the originally script,

       

      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