Let's start off looking at the app.popUpMenu method. It's simpler and structurally both methods are identical, so everything we do with the easier to use method will apply to the other.
This method will take any number of arguments. Each argument is either a string or an array of strings. If we go with the simple case, strings only, we can create a single level list style menu. The menu items are the same as, and appear in the same order as the arguments to the popUpMenu function.
var result = app.popUpMenu("apple", "orange", "coconut", "mango");
To create a sub menu we'll replace one of the string arguments with an array of strings. The first element of the array is always the parent item and the following elements form the items of the submenu.
It is important to note that parent items cannot be selected from the menu and therefore cannot be returned by the popUpMenu method. In the example above, oranges is the only parent item in the menu and so it will never be returned. The sub menu items immediately below the parent item are called the child items, some of which may also be parent items as we'll see in the next example. Only menu items having no children can be returned from the popUpMenu method. These items are called leaves. This terminology is consistent with any hierarchical, or tree type structure.
Simple so far, but what if we want yet another level in the menu. Well, this is easy too. It's just an extension of what we have already done, i.e. replace any string, except the first element in an array, with an array of strings. Let's reorganize the menu from the previous example to try this out.
One last note on this topic. The first element of any array is always the parent element of a sub menu. If it is replaced with another array, or any other data type, the string representation of this value would still be the parent item. The results of such a replacement may be a funny looking and meaningless menu since none of the elements of the replacing item will contribute to the menu list.
OK, so you want to stamp your document. Maybe you need to give reviewers some advice about the document's status or sensitivity. This tip from author Ted Padova demonstrates how to add stamps with the Stamp Tool along with related comments.