Copy link to clipboard
Copied
Hi,
I think I understood the nPos parameter of the app.addMenuItem method, and if several scripts have the same parameter the last item loaded take the place of the previous one.
But I wonder in which order the different .js files of the "JavaScript" folder are loaded to know which is the last one and see if it actually takes the last position indicated. I did several tests and it seems it's not the alphabetical order...
Thanks.
@+
Copy link to clipboard
Copied
The order in which scripts are loaded is not predictable, except that app scripts are loaded before user scripts, and plug-ins are loaded before any script. The script that is adding a menu item would need to examine the existing menu order before determining the insert location.
The nPos parameter can also be the name of an existing menu item, it doesn't have to be a number.
However, I have found that trying to force a menu item position to be problematic to the point that it is not worth the effort. And things have gotten worse with new UI.
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
The order in which scripts are loaded is not predictable, except that app scripts are loaded before user scripts, and plug-ins are loaded before any script. The script that is adding a menu item would need to examine the existing menu order before determining the insert location.
The nPos parameter can also be the name of an existing menu item, it doesn't have to be a number.
However, I have found that trying to force a menu item position to be problematic to the point that it is not worth the effort. And things have gotten worse with new UI.
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
OK, Thanks!

