Hello Rorohiko forum,
First of all I want to say that I am in raptures over APID’s new features — especially adornments. This is terrific!
I have a few questions concerning creating menus:
Is it possible to add a new menu entry to an existing custom submenu (e.g. I’ve already created a submenu called “Scripts” during startup in targetengine "session")?
When I add a new entry into a standard InDesign menu, it works:
“Main:&Edit:Preferences:My Own Menu”
But when I try “Main:Scripts:My Own Menu” – doesn’t.
When I insert a new entry into a standard InDesign menu, can I control its position — like in ESTK2 — at the beginning/end or before/after some menu item?
In MyPlugIn.jsx file I found lines similar to this one – “app.registerMenuItem("menuItem4","Main:0x90B50kActivePageItemMenuKey:.Menutester
:.Menu Bar Item 4",4.0);”
What for is the dot, following the colon, before “Menutester” and “Menu Bar Item 4”?
The cookbook says that ‘menu paths’ should be separated by colons.
It took quite an effort to figure out how to create menu item with check box. Here is what I came up with:
Event Filter: docLoaded, menuCountCharacters, enableMenus
Code:if (theItem.eventCode == "enableMenus") {
if (theItem.tempDataStore != 3) {
theItem.tempDataStore = 1;
}
}
else if (theItem.eventCode == "menuCountCharacters") {
if (theItem.tempDataStore == 1) {
theItem.tempDataStore = 3;
Main();
}
else if (theItem.tempDataStore == 3) {
theItem.tempDataStore = 1;
ClearAdornments();
}
}
else if (theItem.eventCode == "docLoaded") {
app.registerMenuItem("menuCountCharacters", "Count Characters");
ClearAdornments();
}
I read the comments in the file and found that setting ‘theItem.tempDataStore’ to some numeric value makes the menu item enabled/enabled, with/without checkbox, with/without dash.
0 or ‘false’ - disabled
1 or ‘true’ - enabled
2 - disabled with checkbox (2 + 0 = 2)
3 - enabled with checkbox ( 2 + 1 = 3)
4 - disabled with dash (4 + 0 = 4)
5 - enabled with dash (4 + 1 = 5)
According to comments, 15 combinations are possible in all.
I tried other combinations – from 6 to 15 – and they just seem to repeat the previous ones.
IOW are they usable?
One more question:
I want to create two menu items:
Event Filter: menuTest*, selected, enableMenus
Code:if (theItem.eventCode == "enableMenus")
{
theItem.tempDataStore = 1;
}
else if (theItem.eventCode == "menuTest")
{
alert("Menu was selected");
}
else if (theItem.eventCode == "selected")
{
app.registerMenuItem ("menuTest1","Main:0x90B50kActivePageItemMenuKey:Menutest 1");
app.registerMenuItem ("menuTest2","Main:0x90B50kActivePageItemMenuKey:Menutest 2");
alert("Menu Items have been added");
}
Setting ‘theItem.tempDataStore’ to some value changes the state of both menu items at the same time. How to make, for example, one of them enabled and the other disabled?
And finally the last question:
How to use Multi Selected (dash) menu item?
For example, I want to create ‘Fruits’ menu item containing three elements: ‘Apples’, ‘Pears’ and ‘Oranges’. And I want it to be checked/unchecked when all these three elements are checked/unchecked, but I want it to be dashed when some of them selected and some not.
Thank you in advance.
Kasyan