Localization And Menu Names - Adobe 65009333 - InCopy CS4 - PC Manual

Scripting guide: javascript
Hide thumbs Also See for 65009333 - InCopy CS4 - PC:
Table of Contents

Advertisement

Menus
var myMenu;
//Open a new text file.
var myTextFile = File.saveDialog("Save Menu Action Names As", undefined);
//If the user clicked the Cancel button, the result is null.
if(myTextFile != null){
//Open the file with write access.
myTextFile.open("w");
for(var myMenuCounter = 0;myMenuCounter< app.menus.length; myMenuCounter++){
myMenu = app.menus.item(myMenuCounter);
myTextFile.writeln(myMenu.name);
myProcessMenu(myMenu, myTextFile);
}
myTextFile.close();
alert("done!");
}
function myProcessMenu(myMenu, myTextFile){
var myMenuElement;
var myIndent = myGetIndent(myMenu);
for(var myCounter = 0; myCounter < myMenu.menuElements.length; myCounter++){
myMenuElement = myMenu.menuElements.item(myCounter);
if(myMenuElement.getElements()[0].constructor.name != "MenuSeparator"){
}
}
}
function myGetIndent(myObject){
var myString = "\t";
var myDone = false;
do{
if((myObject.parent.constructor.name == "Menu")||
(myObject.parent.constructor.name == "Application")){
}
else{
}
}while(myDone == false)
return myString;
}

Localization and menu names

in InCopy scripting,
this, scripts need a method of locating these objects that is independent of the installed locale of the
application. To do this, you can use an internal database of strings that refer to a specific item, regardless of
the locale. For example, to get the locale-independent name of a menu action, you can use the following
script fragment (for the complete script, see GetKeyStrings):
myTextFile.writeln(myIndent + myMenuElement.name);
if(myMenuElement.getElements()[0].constructor.name == "Submenu"){
if(myMenuElement.menuElements.length > 0){
myProcessMenu(myMenuElement, myTextFile);
}
}
myDone = true;
myString = myString + "\t";
myObject = myObject.parent;
,
menuItems
menus
,
,and
menuActions
submenus
Understanding the menu model 65
are all referred to by name. Because of

Advertisement

Table of Contents
loading

This manual is also suitable for:

Incopy cs4

Table of Contents