Sunday, March 28, 2010

CS4(Execution finished. Result: false)

hi Scriopter,

i write some codes to define active documment with following properties,

composer,kerningMethod,appliedLanguage,hyphenation

but i don't why it return false and no responses with my doc?

your help will be appreciated!!!

if (app.documents.length==0) { 
alert(''open a doc first!'');

}
else {

myActiveDoc = app.activeDocument;

var myDialog = app.dialogs.add({name:''Change all of paragraphStye'', canCancel:true});
with(myDialog) {
  with(dialogColumns.add()) {
   with(borderPanels.add()) {
    with(dialogColumns.add()) {
     staticTexts.add({staticLabel:''Select what you need to change:''});
    }
    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;

    myDialog.destroy();
  if(myParaStyleComposerCS==true) {
     
   
         myActiveDoc.allParagraphStyles.composer=''Adobe CJK 段落书写器'';
      }

//kerning setting
   if(myParaStylekerningCS==true) {
     var RomanKerning=app.translateKeyString(''$ID/原始设定 - 仅罗马字'');
     myActiveDoc.allParagraphStyles.kerningMethod=RomanKerning ;
     //myActiveDoc.paragraphStyles[i].kerningMethod=RomanKerning ;
  
  }
  //language setting
  if(myParaStyleLangCS==true) {
var ChineseLan=app.translateKeyString(''$ID/中文: 简体'');
 
     myActiveDoc.allParagraphStyles.appliedLanguage=ChineseLan;

  }
  //hyphenation setting

  if(myParaStyleHyphenationCS==true) {
 
      myActiveDoc.allParagraphStyles.hyphenation = false;
}
else {
  myDialog.destroy();
}
}
}

Regards

Robin

CS4(Execution finished. Result: false)

Try adding this at the start of your script:

app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;

Dave

No comments:

Post a Comment