Change Language of Document
Hi Chaps,
Back again with another question for you all. . . .
Couple of weeks ago, I found this script by a clever dude, which changes the language of the paragraph/character styles.
I'm wondering if this can either be tweeked or a simple find and replace to allow all text boxes, stories, etc., (that do not have a paragraph/charachter style) to be assigned a language throughout the document.
// changeLanguageOfStyles_xl.js
myDoc=app.documents[0]; var theResult = myDisplayDialog(); myLanguage= theResult[0];
// Paragraph Styles
if (theResult[1] == true)
{
myStyles=myDoc.paragraphStyles;
for (oneStyle=1;oneStyle<myStyles.length;oneStyle++)
{
myStyles[oneStyle].appliedLanguage=myLanguage;
}
}
// Character Styles
if (theResult[2] == true)
{
myStyles=myDoc.characterStyles;
for (oneStyle=1;oneStyle<myStyles.length;oneStyle++)
{
myStyles[oneStyle].appliedLanguage=myLanguage;
}
}
function myDisplayDialog()
{
var theLanguages = app.languagesWithVendors.everyItem().name;
var myDialog = app.dialogs.add({name:"Change the language of the Paragraph Styles"});
with(myDialog.dialogColumns.add()){
with(dialogRows.add()){
with(dialogColumns.add()){
staticTexts.add({staticLabel:"Language:", minWidth:120});
}
with(dialogColumns.add()){
var myLanguagesDropdown = dropdowns.add({stringList:theLanguages, selectedIndex:1});
}
}
with(dialogRows.add())
{
with(dialogColumns.add())
{
staticTexts.add({staticLabel:"Apply to:", minWidth:120});
with(dialogColumns.add())
{
var myParacheckbox = checkboxControls.add({staticLabel:"Paragraph Styles", checkedState:true});
var myCharcheckbox = checkboxControls.add({staticLabel:"Character Styles", checkedState:false});
}
}
}
}
var theResult = myDialog.show();
if(theResult == true){
var theLan = theLanguages[myLanguagesDropdown.selectedIndex]
var theParaSt = myParacheckbox.checkedState;
var theCharSt = myCharcheckbox.checkedState;
myDialog.destroy();
}
else{
myDialog.destroy();
exit();
}
return [theLan, theParaSt, theCharSt];
}
Any ideas?
Cheers,
Mookie
