CHAPTER 9: Menus Understanding the Menu Model 129
To create a list (as a text file) of all menu actions, run the following script fragment (from the
GetMenuActions tutorial script):
var myMenuActionNames = app.menuActions.everyItem().name;
//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 myCounter = 0; myCounter < myMenuActionNames.length; myCounter++){
myTextFile.writeln(myMenuActionNames[myCounter]);
}
myTextFile.close();
}
To create a list (as a text file) of all available menus, run the following script fragment (for the complete
script, see GetMenuNames). These scripts can be very slow, as there are many menu names in InDesign.