27 Replies Latest reply on Jul 6, 2009 4:26 AM by robin521

    Why my Script can not run in CS4?

    robin521 Level 1

      Hi all,

       

      I got a Script that used for my files in CS3, but i can't run in CS4, can anybody help me?

       

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

      //アクティブ文書の判定
      if (app.documents.length==0) {  //現在アクティブな文書があるかどうかを判定
      alert("open it as normal! ");
      //処理を中止
      }
      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) {
         //for (var i=0; i<myParaStyleLength; i++) {
          //if (i==0) {
           //ルートスタイルなので無視
          //}
          //else {
          
           myActiveDoc.ParagraphStyle.Composer= "Adobe CJK 单行书写器" ;
          //}
         //}
        }
        //カーニングの設定
        if(myParaStylekerningCS==true) {
         for (var i=0; i<myParaStyleLength; i++) {
          if (i==0) {
           //ルートスタイルなので無視
          }
          else {
           myActiveDoc.paragraphStyles[i].kerningMethod = "Metrics - Roman Only";
          }
         }
        }
        //言語の設定
        if(myParaStyleLangCS==true) {
         for (var i=0; i<myParaStyleLength; i++) {
          if (i==0) {
           //ルートスタイルなので無視
          }
          else {
           myActiveDoc.paragraphStyles[i].appliedLanguage = "Korean";
          }
         }
        }
        //ハイフネーションの設定
        if(myParaStyleHyphenationCS==true) {
         for (var i=0; i<myParaStyleLength; i++) {
          if (i==0) {
           //ルートスタイルなので無視
          }
          else {
           myActiveDoc.paragraphStyles[i].hyphenation = false;
          }
         }
        }
      }
      else {
        myDialog.destroy();
      }
      }

        • 1. Re: Why my Script can not run in CS4?
          Larry G. Schneider Adobe Community Professional & MVP

          Have you tried putting it into a folder in the Script Panel called Version 5.0 Scripts?

          • 2. Re: Why my Script can not run in CS4?
            robin521 Level 1

            Hi Larry,

             

            Yes, I test them in the script panel, some property has been changed 

            in CS4 I think!

             

            From my iPhone

             

            在 2009-6-2,1:08,"Larry G. Schneider" <forums@adobe.com> 写到:

             

            Have you tried putting it into a folder in the Script Panel calle 

            Version 5.0 Scripts?

            >

            • 3. Re: Why my Script can not run in CS4?
              robin521 Level 1

              Can any body help me?!

               

               

              发自我的 iPhone

               

              在 2009-6-2,1:08,"Larry G. Schneider" <forums@adobe.com> 写到:

               

              Have you tried putting it into a folder in the Script Panel calle 

              Version 5.0 Scripts?

              >

              • 4. Re: Why my Script can not run in CS4?
                [Jongware] Most Valuable Participant

                "It does not work" is not very helpful.

                What does not work?

                • 5. Re: Why my Script can not run in CS4?
                  robin521 Level 1

                  Hi Jongware,

                   

                  thanks , as i said that my script does not work, because of it was CS3 version script and in the CS4, "composer","kerningMethod","appliedLanguage","hyphenation" belong to ParagraphStyle not ParagraphStyles, i think this is the root of the problerms.

                  but how can i get rid of it?

                   

                  when i run it , it will be raise a error that"the object paragraphStyle can not support the method and properties!"

                  • 6. Re: Why my Script can not run in CS4?
                    robin521 Level 1

                    Hi Script,

                     

                    a original edition is :

                     

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

                    //アクティブ文書の判定
                    if (app.documents.length==0) {  //現在アクティブな文書があるかどうかを判定
                    alert("请您打开文档");
                    //処理を中止
                    }
                    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) {
                       //for (var i=0; i<myParaStyleLength; i++) {
                        //if (i==0) {
                         //ルートスタイルなので無視
                        //}
                        //else {
                        
                         myActiveDoc.ParagraphStyle.Composer= "Adobe CJK 单行书写器" ;
                        //}
                       //}
                      }
                      //カーニングの設定
                      if(myParaStylekerningCS==true) {
                       for (var i=0; i<myParaStyleLength; i++) {
                        if (i==0) {
                         //ルートスタイルなので無視
                        }
                        else {
                         myActiveDoc.paragraphStyles[i].kerningMethod = "Metrics - Roman Only";
                        }
                       }
                      }
                      //言語の設定
                      if(myParaStyleLangCS==true) {
                       for (var i=0; i<myParaStyleLength; i++) {
                        if (i==0) {
                         //ルートスタイルなので無視
                        }
                        else {
                         myActiveDoc.paragraphStyles[i].appliedLanguage = "Korean";
                        }
                       }
                      }
                      //ハイフネーションの設定
                      if(myParaStyleHyphenationCS==true) {
                       for (var i=0; i<myParaStyleLength; i++) {
                        if (i==0) {
                         //ルートスタイルなので無視
                        }
                        else {
                         myActiveDoc.paragraphStyles[i].hyphenation = false;
                        }
                       }
                      }
                    }
                    else {
                      myDialog.destroy();
                    }
                    }

                     

                    i have been rewrite the script in order to avoid the error i just said, convert all the value to string, no error now, but no change with my files still.

                    the new edition is following:

                     

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

                    //アクティブ文書の判定
                    if (app.documents.length==0) {  //現在アクティブな文書があるかどうかを判定
                    alert("帅哥、美女,你要开一个文档啊!");
                    //処理を中止
                    }
                    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/Adobe CJK 段落书写器");
                     
                       for (var i=0; i<myParaStyleLength; i++) {
                        if (i==0) {
                         //ルートスタイルなので無視
                        }
                        else {
                         myActiveDoc.paragraphStyles[i].composer = ParaComposer;
                         //myActiveDoc.paragraphStyles[i].composer = "Adobe CJK 段落书写器";
                        }
                       }
                      }
                      //カーニングの設定
                      if(myParaStylekerningCS==true) {
                     
                      
                      var RomanKerning=app.translateKeyString("$ID/原始设定 - 仅罗马字");
                       for (var i=0; i<myParaStyleLength; i++) {
                        if (i==0) {
                         //ルートスタイルなので無視
                        }
                        else {
                        
                         myActiveDoc.paragraphStyles[i].kerningMethod=RomanKerning ;
                        }
                       }
                      }
                      //言語の設定
                      if(myParaStyleLangCS==true) {
                    var ChineseLan=app.translateKeyString("$ID/中文: 简体");
                      
                       for (var i=0; i<myParaStyleLength; i++) {
                        if (i==0) {
                         //ルートスタイルなので無視
                        }
                        else {
                        
                         myActiveDoc.paragraphStyles[i].appliedLanguage=ChineseLan;
                        
                        }
                       }
                      }
                      //ハイフネーションの設定
                      if(myParaStyleHyphenationCS==true) {
                       for (var i=0; i<myParaStyleLength; i++) {
                        if (i==0) {
                         //ルートスタイルなので無視
                        }
                        else {
                         myActiveDoc.paragraphStyles[i].hyphenation = false;
                        }
                       }
                      }
                    }
                    else {
                      myDialog.destroy();
                    }
                    }

                    • 7. Re: Why my Script can not run in CS4?
                      [Jongware] Most Valuable Participant

                      Okay, that's much better. It seems you changed "myActiveDoc.paragraphStyles' to "myActiveDoc.ParagraphStyle" at least once, and that caused the original error.

                       

                      This last version appears to run just fine on my CS4 -- from bottom to top, hyphenation switches off, the language changes gives an error (apparently I don't have "Korean" installed), kerning changes to "Metrics - Roman Only" (I didn't even know that one existed), and finally the top option.

                      Now that still yields an error:

                      Error String: Object does not support the property or method 'ParagraphStyle'

                      File: C:\Documents and Settings\Optima DTP\Application Data\Adobe\InDesign\Version 6.0\en_GB\Scripts\Scripts Panel\00-tries\ZZZtry.js
                      Line: 56
                      Source:      myActiveDoc.ParagraphStyle.Composer= "Adobe CJK 单行书写器" ;

                      For some reason this line still has the original error I mentioned above; it should most likely be the loop

                       

                      for (var i=1; i<myParaStyleLength; i++) {
                           myActiveDoc.paragraphStyles[i].Composer = "Adobe CJK 单行书写器" ;
                      }

                       

                      (Note that this loop was there but has been commented out. Also, you can start directly with '1' instead of '0' and skipping if it is '0'.)

                      -- which promptly gives another error: "Composer" is not a property of ParagraphStyle. Checking the JS reference for CS4 confirms that -- it's "composer" (JavaScript is case sensitive!), and with that final change it returns a totally predictable error -- I don't have the CJK composer, so it complaints about that. On your system this should work:

                       

                      for (var i=1; i<myParaStyleLength; i++) {
                           myActiveDoc.paragraphStyles[i].composer = "Adobe CJK 单行书写器" ;
                      }

                      1 person found this helpful
                      • 8. Re: Why my Script can not run in CS4?
                        Harbs. Level 6

                        Jong, that's one of the CJK kerning options. It's not much use except 

                        for CJK composition...

                         

                        Robin,

                         

                        Besides what Jong said; You should make sure that the Composer is 

                        spelled correctly.

                         

                        Set the composer and run this:

                        $.writeln(app.selection[0].composer);

                         

                        Copy the result an run:

                        $.writeln(app.findKeyStrings (result ));

                         

                        This will give you the correct locale independent string for your 

                        composer. Copy and paste that into the correct location in your script.

                         

                        Harbs

                        • 9. Re: Why my Script can not run in CS4?
                          robin521 Level 1

                          Thanks for your help, I thinks I have been use this method in my old 

                          version,it will be prompt that compose is not valid, and need string 

                          but you sent"cjk 单行书写器" ,i try convert it to string,but there are 

                          no error and response also,otherwise,about composer or Composer's pro 

                          you are right, I need carefully!presently, I don't know what to do now!

                           

                          From my  iPhone

                           

                          在 2009-6-2,18:39,"Harbs." <forums@adobe.com> 写到:

                           

                          Jong, that's one of the CJK kerning options. It's not much use except

                          for CJK composition...

                          >

                          Robin,

                          >

                          Besides what Jong said; You should make sure that the Composer is

                          spelled correctly.

                          >

                          Set the composer and run this:

                          $.writeln(app.selection[0].composer);

                          >

                          Copy the result an run:

                          $.writeln(app.findKeyStrings (result ));

                          >

                          This will give you the correct locale independent string for your

                          composer. Copy and paste that into the correct location in your 

                          script.

                          >

                          Harbs

                          >

                          • 10. Re: Why my Script can not run in CS4?
                            Harbs. Level 6

                            What were the results of the two $.writeln commands?

                            • 11. Re: Why my Script can not run in CS4?
                              robin521 Level 1

                              Thank you ! I will try it after a while.but I want to confirm" 

                              $.writelin

                              "right!?

                              发自我的 iPhone

                               

                              在 2009-6-2,18:39,"Harbs." <forums@adobe.com> 写到:

                               

                              Jong, that's one of the CJK kerning options. It's not much use except

                              for CJK composition...

                              >

                              Robin,

                              >

                              Besides what Jong said; You should make sure that the Composer is

                              spelled correctly.

                              >

                              Set the composer and run this:

                              $.writeln(app.selection[0].composer);

                              >

                              Copy the result an run:

                              $.writeln(app.findKeyStrings (result ));

                              >

                              This will give you the correct locale independent string for your

                              composer. Copy and paste that into the correct location in your 

                              script.

                              >

                              Harbs

                              >

                              • 12. Re: Why my Script can not run in CS4?
                                Harbs. Level 6

                                No. There's no "i". Just copy and paste my code.

                                 

                                The result will show up in the ESTK console...

                                 

                                Harbs

                                • 13. Re: Why my Script can not run in CS4?
                                  robin521 Level 1

                                  I'm so Sorry, it's 20:31 here, i must off now.I will test them 

                                  tomorrow morning,thanks again!

                                   

                                  发自我的 iPhone

                                   

                                  在 2009-6-2,20:09,"Harbs." <forums@adobe.com> 写到:

                                   

                                  What were the results of the two $.writeln commands?

                                  >

                                  • 14. Re: Why my Script can not run in CS4?
                                    robin521 Level 1

                                    Hi Harbs,

                                     

                                    thanks again, i have been test the code you sent to me , And the comment on the Console Panel is :

                                     

                                     

                                    for (var i=0; i<myParaStyleLength; i++) {
                                        if (i==0) {
                                         //如果当前没有段落样式,则跳过
                                        }
                                        else {
                                         //myActiveDoc.paragraphStyles[i].composer = ParaC;
                                         //myActiveDoc.paragraphStyles[i].composer = "Adobe CJK 段落书写器";
                                        // app.selection[0].composer="Adobe CJK 段落书写器";
                                           $.writeln(app.selection[0].composer);
                                           $.writeln(app.findKeyStrings (result));

                                        }
                                       }
                                      }

                                     

                                    Console Panel:

                                     

                                    $.writeln(app.selection[0].composer);

                                    ----Execution finished. Result: false
                                    Adobe CJK 段落书写器

                                    $.writeln(app.findKeyStrings (result ));

                                    ----result has not define

                                     

                                    Regards,

                                    Robin

                                    • 15. Re: Why my Script can not run in CS4?
                                      Harbs. Level 6

                                      What do you get for :

                                       

                                      $.writeln(app.findKeyStrings ("Adobe CJK 段落书写器"));

                                       

                                      Harbs

                                      • 16. Re: Why my Script can not run in CS4?
                                        robin521 Level 1

                                        Hi Harbs,

                                         

                                        yes, i try it also before, the result is:

                                         

                                        Adobe CJK 段落书写器
                                        $ID/HL Composer J
                                        Adobe CJK 段落书写器
                                        $ID/HL Composer J
                                        Adobe CJK 段落书写器
                                        $ID/HL Composer J
                                        Adobe CJK 段落书写器
                                        $ID/HL Composer J
                                        Adobe CJK 段落书写器
                                        $ID/HL Composer J
                                        Adobe CJK 段落书写器
                                        $ID/HL Composer J
                                        Adobe CJK 段落书写器
                                        $ID/HL Composer J
                                        Adobe CJK 段落书写器
                                        $ID/HL Composer J
                                        Adobe CJK 段落书写器
                                        $ID/HL Composer J
                                        Adobe CJK 段落书写器
                                        $ID/HL Composer J
                                        Adobe CJK 段落书写器
                                        $ID/HL Composer J
                                        Adobe CJK 段落书写器
                                        $ID/HL Composer J
                                        Adobe CJK 段落书写器
                                        $ID/HL Composer J
                                        Adobe CJK 段落书写器
                                        $ID/HL Composer J
                                        Adobe CJK 段落书写器
                                        $ID/HL Composer J
                                        Adobe CJK 段落书写器
                                        $ID/HL Composer J
                                        Adobe CJK 段落书写器
                                        $ID/HL Composer J
                                        Adobe CJK 段落书写器
                                        $ID/HL Composer J
                                        Adobe CJK 段落书写器
                                        $ID/HL Composer J
                                        Adobe CJK 段落书写器
                                        $ID/HL Composer J
                                        Adobe CJK 段落书写器
                                        $ID/HL Composer J
                                        Adobe CJK 段落书写器
                                        $ID/HL Composer J
                                        Adobe CJK 段落书写器
                                        $ID/HL Composer J
                                        Adobe CJK 段落书写器
                                        $ID/HL Composer J
                                        Adobe CJK 段落书写器
                                        $ID/HL Composer J
                                        Adobe CJK 段落书写器
                                        $ID/HL Composer J
                                        Adobe CJK 段落书写器
                                        $ID/HL Composer J

                                         

                                        Regards,

                                        Robin

                                        • 17. Re: Why my Script can not run in CS4?
                                          Harbs. Level 6

                                          Okay, very good. I had a feeling you were talking about the J 

                                          composer...

                                           

                                          When you're trying to apply the composer you need: yourObject.composer 

                                          = "$ID/HL Composer J";

                                           

                                          Harbs

                                          1 person found this helpful
                                          • 18. Re: Why my Script can not run in CS4?
                                            robin521 Level 1

                                            Hi Harbs,

                                             

                                            yes, the original version is from japen, now i use it with CJK, you mean change it as:

                                             

                                            myActiveDoc.paragraphStyles[i].composer ="$ID/HL Composer J";

                                             

                                             

                                            yes, i try it , no response with the paragraph.

                                             

                                             

                                            Regards,

                                            Robin

                                            • 19. Re: Why my Script can not run in CS4?
                                              robin521 Level 1

                                              Hi Harbs,

                                               

                                              I want to konw is there any difference  with

                                              app.selection[0].composer="Adobe CJK 段落书写器"; and myActiveDoc.paragraphStyles[i].composer = "Adobe CJK 段落书写器";

                                               

                                              if no difference with their.

                                               

                                              how about this :

                                               

                                              myParaLength=?;

                                              for (var i=0; i<myParaLength; i++) {
                                                  if (i==0) {
                                                   //如果当前没有段落样式,则跳过
                                                  }
                                                  else {
                                                app.selection[i].composer="Adobe CJK 段落书写器";
                                                    

                                                  }
                                                 }
                                                }

                                               

                                              Regards,

                                              Robin

                                              • 20. Re: Why my Script can not run in CS4?
                                                robin521 Level 1

                                                Hi Jongware,

                                                 

                                                why this operation base on ParagraphStyle not Selection[i].composer, is there any difference?

                                                 

                                                Actually, i find that "app.selection[0].composer="Adobe CJK 段落书写器";" is ok,

                                                 

                                                how about loop all files with this method?

                                                • 21. Re: Why my Script can not run in CS4?
                                                  robin521 Level 1

                                                  Hi Harbs,

                                                   

                                                  it's very helpful, thank you! but you know i got four properties to change, if this same way i could do that to rewrite them as "$ID/Roma- only","Chinese Langee" .. waht i said before?

                                                   

                                                   

                                                  Regards,

                                                  Robin

                                                  • 22. Re: Why my Script can not run in CS4?
                                                    Harbs. Level 6

                                                    Wait. You are changing it from the J composer to the Chinese/Korean 

                                                    composer?

                                                     

                                                    Apply that composer manually and write to the console the string you 

                                                    get.

                                                     

                                                    Harbs

                                                    • 23. Re: Why my Script can not run in CS4?
                                                      [Jongware] Most Valuable Participant

                                                      That will apply the paragraph composer to the paragraph directly instead of through the applied paragraph styles (and then it shows a '+' in the Paragraph Style panel). I don't recommend that -- you should be changing the styles -- but if you want to use the overrides, use this single-line script:

                                                       

                                                      app.selection[0].parentStory.paragraphs.everyItem().composer = "Adobe Single-line Composer";

                                                       

                                                      (where the paragraph composer should be your CJK name). Click the text cursor inside a story and run this script; it applies the composer to every paragraph.

                                                      • 24. Re: Why my Script can not run in CS4?
                                                        robin521 Level 1

                                                        Ok,thank you! I will try it.

                                                         

                                                        发自我的 iPhone

                                                         

                                                        在 2009-6-3,19:15,"[Jongware]" <forums@adobe.com> 写到:

                                                         

                                                        That will apply the paragraph composer to the paragraph directly 

                                                        instead of through the applied paragraph styles (and then it shows a 

                                                        '+' in the Paragraph Style panel). I don't recommend that -- you 

                                                        should be changing the styles -- but if you want to use the 

                                                        overrides, use this single-line script:

                                                        >

                                                        app.selection[0].parentStory.paragraphs.everyItem().composer = 

                                                        "Adobe Single-line Composer";

                                                        >

                                                        (where the paragraph composer should be your CJK name). Click the 

                                                        text cursor inside a story and run this script; it applies the 

                                                        composer to every paragraph.

                                                        >

                                                        • 25. Re: Why my Script can not run in CS4?
                                                          robin521 Level 1

                                                          Yes, in cs3 It's ok, I think CJK could run it with no change.

                                                           

                                                          发自我的 iPhone

                                                           

                                                          在 2009-6-3,19:06,"Harbs." <forums@adobe.com> 写到:

                                                           

                                                          Wait. You are changing it from the J composer to the Chinese/Korean

                                                          composer?

                                                          >

                                                          Apply that composer manually and write to the console the string you

                                                          get.

                                                          >

                                                          Harbs

                                                          >

                                                          • 26. Re: Why my Script can not run in CS4?
                                                            robin521 Level 1

                                                            Hi Herbs,

                                                             

                                                            i have been rewrite my Script according what you said, 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!

                                                             

                                                            Regards,

                                                            Robin

                                                            • 27. Re: Why my Script can not run in CS4?
                                                              robin521 Level 1

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

                                                              //アクティブ文書の判定
                                                              if (app.documents.length==0) {  //現在アクティブな文書があるかどうかを判定
                                                              alert("帅哥、美女,你要开一个文档啊!");
                                                              //処理を中止
                                                              }
                                                              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();
                                                              }
                                                              }